Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43782 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94232 invoked from network); 26 Apr 2009 23:27:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2009 23:27:36 -0000 Authentication-Results: pb1.pair.com header.from=pablo@pablo.com.mx; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pablo@pablo.com.mx; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pablo.com.mx from 209.85.217.175 cause and error) X-PHP-List-Original-Sender: pablo@pablo.com.mx X-Host-Fingerprint: 209.85.217.175 mail-gx0-f175.google.com Received: from [209.85.217.175] ([209.85.217.175:58703] helo=mail-gx0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/80-00271-7EDE4F94 for ; Sun, 26 Apr 2009 19:27:35 -0400 Received: by gxk23 with SMTP id 23so190146gxk.23 for ; Sun, 26 Apr 2009 16:27:32 -0700 (PDT) MIME-Version: 1.0 Sender: pablo@pablo.com.mx Received: by 10.150.52.2 with SMTP id z2mr8951558ybz.90.1240788452393; Sun, 26 Apr 2009 16:27:32 -0700 (PDT) In-Reply-To: References: <771f697e0904261428s678548a4w14a8270e8ecb4ceb@mail.gmail.com> Date: Sun, 26 Apr 2009 18:27:32 -0500 X-Google-Sender-Auth: 2a8ee80206079496 Message-ID: <771f697e0904261627if16d200qc2986ca957a2b45a@mail.gmail.com> To: Etienne Kneuss Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] get_called_class returns empty on spl_autoload* From: pfischer@php.net (Pablo Fischer) Hm, probably it's my version of PHP 5.3, I noticed I've beta1.... I'll compile a new one and let you know if I still have issues :-) I'm also testing on MacOS. On Sun, Apr 26, 2009 at 6:13 PM, Etienne Kneuss wrote= : > Hello, > > On Sun, Apr 26, 2009 at 11:28 PM, Pablo Fischer wrote: >> Hello, >> >> Was playing with get_called_class inside an autoload method that is >> registered via spl_autoload_register and noticed: >> >> =A0- If I use get_called_class inside an autoload method I get an empty >> value from it >> =A0- However the same doesn't happen if I'm not using a registered autol= oad method >> >> Was wondering if this is a bug, a feature or something I'm just missing = :-) >> >> The code I'm using is: >> >> class Loader { >> =A0 =A0public static function autoload($className) >> =A0 =A0{ >> =A0 =A0 =A0 =A0var_dump('Calling ' . get_called_class() . ' for ' . $cla= ssName); >> =A0 =A0} >> =A0 =A0public static function getCalledClass() >> =A0 =A0{ >> =A0 =A0 =A0 =A0var_dump('Current class is: ' . get_called_class()); >> =A0 =A0} >> } >> >> spl_autoload_register(array('Loader', 'autoload')); >> Loader::getCalledClass(); >> $foo =3D new Foo; >> >> And I get: >> string(24) "Current class is: Loader" >> string(16) "Calling =A0for Foo" >> Fatal error: Class 'Foo' not found in >> /Users/pablo/Projects/reptilia/test.php on line 17 >> > > I can't reproduce, can you check with latest 5_3 ? > > Thanks in advance. > >> Thanks! >> -- >> Pablo Fischer (pablo [arroba/at] pablo.com.mx) >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > > -- > Etienne Kneuss > http://www.colder.ch > > Men never do evil so completely and cheerfully as > when they do it from a religious conviction. > -- Pascal > --=20 Pablo Fischer (pablo [arroba/at] pablo.com.mx)