#42009 [Opn->Asn]: is_subclass_of: behaviour contradicts is_a.phpt testcase description
| From: | jani@php.net | Date: | Fri, 17 Aug 2007 20:13:26 +0000 |
| Subject: | #42009 [Opn->Asn]: is_subclass_of: behaviour contradicts is_a.phpt testcase description | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116266@lists.php.net to get a copy of this message | ||
ID: 42009
Updated by: jani@php.net
Reported By: robin_fernandes at uk dot ibm dot com
-Status: Open
+Status: Assigned
Bug Type: Scripting Engine problem
-Operating System: Windows
+Operating System: *
-PHP Version: 5CVS-2007-07-16 (snap)
+PHP Version: 5CVS-2007-08-17
-Assigned To:
+Assigned To: dmitry
New Comment:
According to the commit log is_a() and is_subclass_of() should NOT call
__autoload, in the same way as "instanceof" operator.
But indeed the is_a.phpt does have check to see if __autoload was
called and expects it -> there's bug somewhere.
Dmitry, please check this out.
Previous Comments:
------------------------------------------------------------------------
[2007-07-16 15:02:50] robin_fernandes at uk dot ibm dot com
Description:
------------
This is either a minor mistake in a testcase description, or a bug in
is_subclass_of().
The description of testcase
http://lxr.php.net/source/ZendEngine2/tests/is_a.phpt
states:
"is_a() and is_subclass_of() shouldn't call __autoload".
However, the expected output explicitly checks for __autoload() calls
*in some cases* (lines 49 and 50).
Either the testcase description (and perhaps documentation) should
clarify in which circumstances is_subclass_of() does result in an
invocation of __autoload(), or is_subclass_of() should be fixed.
Below is a simplified testcase illustrating a case where
is_subclass_of() does invoke __autoload().
Reproduce code:
---------------
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
}
Class Def {}
var_dump(is_subclass_of("Def", "Undef"));
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
AUTOLOAD 'Undef'
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42009&edit=1