|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-07-16 15:02 UTC] 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) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
This has been fixed for the second argument passed to is_subclass_of(), but not the first. The test below shows that is_subclass_of() still invokes __autoload() for the first argument, contradicting the description (but not the content) of test is_a.phpt. Note that if this is fixed, the expected output for is_a.phpt will need to change. ---( Test case: )--- <?php function __autoload($name) { echo("AUTOLOAD '$name'\n"); } Class Def {} var_dump(is_subclass_of("Undef", "Def")); ?> ---( Expected output: )--- Warning: Unknown class passed as parameter in %s on line 6 bool(false) ---( Actual output: )--- AUTOLOAD 'Undef' Warning: Unknown class passed as parameter in %s on line 6 bool(false)