News for hackers. Stuff that matters.
Re:PHP 8.4 by williamdclt on Thursday November 21, 2024 @12:13PM (#42206389)
"if not defined" doesn't help, if your own `array_find` doesn't have the same signature and semantics than the new global then you're screwed. You'd want the opposite: overwrite it if it already exists in the global scope (dunno if that's easy / how that'd work in PHP)
Re:PHP 8.4 by nodogoto on Thursday November 21, 2024 @12:57PM (#42206844)
You can't redefine functions in PHP.
Re:PHP 8.4 by mklepaczewski on Thursday November 21, 2024 @03:34PM (#42208351)
There are extensions which allow you to redefine even constants.
Re:PHP 8.4 by asddubs on Thursday November 21, 2024 @02:05PM (#42207504)
the answer is using a namespace
Re:PHP 8.4 by someothherguyy on Thursday November 21, 2024 @02:10PM (#42207560)
> `array_find` doesn't have the same signature and semantics than the new global then you're screwed

Screwed? Just rename or move the function to a namespace in an IDE and it will update all your references?