Reputation: 193
I'm trying to understand in the Breaking Changes for PHP 7.4 to 8.0 what is causing the below line to throw a Fatal TypeError. Obviously, I know it isn't correct but need clarity on what is causing it. Perhaps it has something to do with the php.ini default value changes? I don't get any errors using PHP 7.4.
echo method_exists(false, 'pre_setup') . PHP_EOL;
Upvotes: 3
Views: 4778
Reputation: 17443
I'm not sure why it isn't listed anywhere in the breaking changes (unless I'm missing something). It certainly seems like one.
The change was Bug #79462 being fixed, which aligned the behaviour of method_exists
and property_exists
. The decision was to go with the stricter of the two behaviours, and raise a TypeError
on invalid arguments.
It's listed in the PHP 8 changelog, although I can see why that would be hard to track down.
One of the Symfony core team opened a PHP bug for it here: https://bugs.php.net/bug.php?id=79623, so you're definitely not the only person that's been affected.
Upvotes: 6