Re: is_a() triggers __autoload() in 5.3.7
| From: | Stas Malyshev | Date: | Mon, 22 Aug 2011 18:38:42 +0000 |
| Subject: | Re: is_a() triggers __autoload() in 5.3.7 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54802@lists.php.net to get a copy of this message | ||
Hi!
On 8/21/11 11:22 PM, Mads Lie Jensen wrote:
Ah, I now see that it only happens when trying to check something which is not actually an object: <?php function __autoload($class) { echo "Would load: " . $class . PHP_EOL; } $var = "test"; var_dump(is_a($var, 'B')); $obj = new Stdclass; var_dump(is_a($obj, 'C')); ?>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. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227