Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54776 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6422 invoked from network); 22 Aug 2011 08:20:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2011 08:20:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:58387] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/64-13024-F41125E4 for ; Mon, 22 Aug 2011 04:20:31 -0400 Received: by bkd19 with SMTP id 19so3695718bkd.29 for ; Mon, 22 Aug 2011 01:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=SrHiX16WBOIW77w3BBcmYm0W6a9HMLm/Pd79eWOu1D4=; b=eD/GhU4IYJ6zIV+HJjAgD1wTDWGIJG8eGF/hY4GaZgLfN7Wzn0Hz6cphkYl0ZUKDS2 rfNOOTKXqZHqY+kthj3VXJSzI5zIj4fJGSqIxvRqKWod1c1CICkpS2MV0lGU419Pemmb OYzOUSaRuNEy0BnUdojAD7avPTNruqKhVzlEM= MIME-Version: 1.0 Received: by 10.204.138.193 with SMTP id b1mr772434bku.114.1314001226383; Mon, 22 Aug 2011 01:20:26 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.148.69 with HTTP; Mon, 22 Aug 2011 01:20:26 -0700 (PDT) In-Reply-To: References: Date: Mon, 22 Aug 2011 10:20:26 +0200 X-Google-Sender-Auth: xjVX2dgRVv_AnGDmPR8WxmG0rVM Message-ID: To: Mads Lie Jensen Cc: internals@lists.php.net, Dmitry Stogov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] is_a() triggers __autoload() in 5.3.7 From: colder@php.net (Etienne Kneuss) Hi, On Mon, Aug 22, 2011 at 08:22, Mads Lie Jensen wrote: > On Mon, 22 Aug 2011 08:10:28 +0200, kalle@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 =C2=A0mention 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: > > > function __autoload($class) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0echo "Would load: " . $class . PHP_EOL; > } > > $var =3D "test"; > var_dump(is_a($var, 'B')); > > $obj =3D 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 - mads@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 > > --=20 Etienne Kneuss http://www.colder.ch