Bug #55475 [Asn]: is_a() triggers autoloader

From: Date: Mon, 22 Aug 2011 14:27:31 +0000
Subject: Bug #55475 [Asn]: is_a() triggers autoloader
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-162792@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1

 ID:                 55475
 Updated by:         colder@php.net
 Reported by:        mads at gartneriet dot dk
 Summary:            is_a() triggers autoloader
 Status:             Assigned
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        5.3.7
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

But what BC break are you talking about exactly?

It went from not-working (returning always false for strings as first argument) 
to working with autoload.


Previous Comments:
------------------------------------------------------------------------
[2011-08-22 13:41:16] kalle@php.net

I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I
don't agree to break BC in the middle of a stable release series nor as much as I would like to
myself to achieve the right behaviour.

------------------------------------------------------------------------
[2011-08-22 13:31:21] colder@php.net

It seems correct to me as well to trigger autoload in this case. It does and 
always did so for is_subclass_of(), I don't see any reason for a condition of 
"subclasses_only" to yes or no trigger the autoload.

------------------------------------------------------------------------
[2011-08-22 11:00:28] dmitry@php.net

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.

------------------------------------------------------------------------
[2011-08-22 10:30:19] kalle@php.net

The following patch has been added/updated:

Patch Name: bug55475
Revision:   1314009019
URL:        https://bugs.php.net/patch-display.php?bug=55475&patch=bug55475&revision=1314009019

------------------------------------------------------------------------
[2011-08-22 10:29:51] kalle@php.net

Zeev, although the functionality might appear as it should be then we should not make sudden changes
like that in the middle of a stable branch, we should patch up 5.3 and keep the behaviour in 5.4 if
its indeed intended atleast to comply with previous versions.

The fix for 5.3 is simple, attached

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=55475


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1


Thread (51 messages)

« previous php.bugs (#162792) next »