Re: PHP 5.3.8 Released!

From: Date: Wed, 24 Aug 2011 09:37:28 +0000
Subject: Re: PHP 5.3.8 Released!
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Since when has changing documented behaviour and breaking a large number of applications been acceptable? (Well, happens occasionally by accident ..)

This was a 'feature change' to is_a(), it was documented as _only_ returning 'TRUE' when an object was passed as the first object and it was an instance of that...

I did read through the previous posts, (just caught up the other day), it looks like if anybody really need to do what this new feature provides, (which is probably very rare), then

$left == $right || is_subclass_of($left,$right)

should work fine without breaking any code.

Regards
Alan

On Wednesday, August 24, 2011 03:44 PM, Ferenc Kovacs wrote:
On Wed, Aug 24, 2011 at 3:57 AM, [email protected]<[email protected]> wrote:
It might have been better to have waited for the is_a() fix to get sorted out.. - It's a very annoying BC break (changes the documented behaviour), and now it means we need 4.3.9 in a few more days. Let me know if you need help testing / applying etc..
from what I understand, this won't be changed, as the current behavior is correct, the old was a bug: as Stas pointed out: "Not a bug. $var is interpreted as a class name. To know if one class extends another, the class in question (first one) should be loaded. There's no need to load the second one since if it's unknown nothing can be instance of it and existing classes can not extend it." if you used this previously from Dmitry: "Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments." so your example was bogus, as passing a non-object as a first parameter wasn't supported (see http://php.net/is_a) so your code example depends on an undefined behavior and results in a bogus result (is_a() alwas returned false if you passed a non-object) so in a way it is really a BC, but I think that this change is really a bugfix.


Thread (54 messages)

« previous php.internals (#54853) next »