Hi,

On Mon, Aug 22, 2011 at 08:22, Mads Lie Jensen <m...@gartneriet.dk> wrote:
> On Mon, 22 Aug 2011 08:10:28 +0200, ka...@php.net (Kalle Sommer Nielsen)
> wrote:
>
>>> After upgrading to php 5.3.7, whenever I use is_a($object, 'ClassName');
>>> the autoloader of classes is now called.
>>>
>>> This did not happen in earlier versions of php 5.3 that I used before.
>>> But I cannot find any  mention of it anywhere, no open bugs for it, and
>>> nothing in the changelogs.
>>>
>>> Is it a bug or is it intentional that it has started behaving this way?
>>
>>I'm unable to reproduce your case in 5.3.4RC1, 5.3.7 and 5.3-svn:
>>http://pastie.org/2410070
>
> 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'));
>
> ?>
>
> But still, it did not happen in earlier phpversions.
Here is the situation:

1) The underlying implementation is shared between is_a and is_subclass_of.
2) Previously, strings as first argument was not permitted by is_a but
was for is_subclass_of,
3) is_subclass_of always triggered autoload in such cases.
4) Following a fix from Dmitry, the underlying implementation now
allows a string as first argument for is_a as well.

Conclusion: it is now consistent, but if you wrongly used is_a with a
string before, it now triggers autoload because it actually accepts
it.

Best,

> --
> Mads Lie Jensen - m...@gartneriet.dk - ICQ #25478403
> Gartneriet - http://www.gartneriet.dk/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Etienne Kneuss
http://www.colder.ch

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to