Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55051 invoked from network); 27 Apr 2009 16:19:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2009 16:19:09 -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 74.125.46.31 cause and error) X-PHP-List-Original-Sender: pablo@pablo.com.mx X-Host-Fingerprint: 74.125.46.31 yw-out-2324.google.com Received: from [74.125.46.31] ([74.125.46.31:19242] helo=yw-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/90-09611-AFAD5F94 for ; Mon, 27 Apr 2009 12:19:08 -0400 Received: by yw-out-2324.google.com with SMTP id 3so1442545ywj.83 for ; Mon, 27 Apr 2009 09:19:04 -0700 (PDT) MIME-Version: 1.0 Sender: pablo@pablo.com.mx Received: by 10.151.137.5 with SMTP id p5mr9074767ybn.223.1240849144402; Mon, 27 Apr 2009 09:19:04 -0700 (PDT) In-Reply-To: <771f697e0904261627if16d200qc2986ca957a2b45a@mail.gmail.com> References: <771f697e0904261428s678548a4w14a8270e8ecb4ceb@mail.gmail.com> <771f697e0904261627if16d200qc2986ca957a2b45a@mail.gmail.com> Date: Mon, 27 Apr 2009 11:19:04 -0500 X-Google-Sender-Auth: f451e70e1747d8e3 Message-ID: <771f697e0904270919v622ade3eie652f7260d6acb23@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) Hi, Well, I upgraded my php5.3 version and I still see the same thing: $ php test.php string(24) "Current class is: Loader" string(16) "Calling for Foo" Fatal error: Class 'Foo' not found in /Users/pablo/Projects/reptilia/test.php on line 17 $ php --version PHP 5.3.0RC1 (cli) (built: Apr 27 2009 11:12:36) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies As I said, not sure if this is the way spl_autoload_register should work with get_called_class(). thanks! On Sun, Apr 26, 2009 at 6:27 PM, Pablo Fischer wrote: > 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 wro= te: >> 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 auto= load 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 ' . $cl= assName); >>> =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 >> > > > > -- > Pablo Fischer (pablo [arroba/at] pablo.com.mx) > --=20 Pablo Fischer (pablo [arroba/at] pablo.com.mx)