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 <pfisc...@php.net> 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 <webmas...@colder.ch> wrote: >> Hello, >> >> On Sun, Apr 26, 2009 at 11:28 PM, Pablo Fischer <pfisc...@php.net> wrote: >>> Hello, >>> >>> Was playing with get_called_class inside an autoload method that is >>> registered via spl_autoload_register and noticed: >>> >>> - If I use get_called_class inside an autoload method I get an empty >>> value from it >>> - However the same doesn't happen if I'm not using a registered autoload >>> method >>> >>> Was wondering if this is a bug, a feature or something I'm just missing :-) >>> >>> The code I'm using is: >>> >>> class Loader { >>> public static function autoload($className) >>> { >>> var_dump('Calling ' . get_called_class() . ' for ' . $className); >>> } >>> public static function getCalledClass() >>> { >>> var_dump('Current class is: ' . get_called_class()); >>> } >>> } >>> >>> spl_autoload_register(array('Loader', 'autoload')); >>> Loader::getCalledClass(); >>> $foo = new Foo; >>> >>> And I get: >>> 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 >>> >> >> 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) > -- Pablo Fischer (pablo [arroba/at] pablo.com.mx) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php