Re: Re: strange autoload behavior

From: Date: Thu, 10 Jul 2008 19:00:30 +0000
Subject: Re: Re: strange autoload behavior
References: 1 2 3 4 5 6 7  Groups: php.doc php.internals 
Request: Send a blank email to internals+get-38908@lists.php.net to get a copy of this message
Hi Jochem, not that you really want it, but you could pass the exception as a static property to fully preserve and throw it later again. Something like this: ... sprintf('class %s { public static $e; public function __construct() { throw self::$e; } public function __call($method, array $args) { throw self::$e; } public function __callStatic($method, array $args) { throw self::$e; } }', $class); $class::$e = $e; ... Am Donnerstag, den 10.07.2008, 19:14 +0200 schrieb Jochem Maas: [...] > function __autoload($class) > { > try { > throw new Exception('foo'); > } catch (Exception $e) { > self::handleDebug($e); > > if (!class_exists($class, false)) > eval(sprintf(' > class %1$s > { > public function __construct() { throw new > AL_Exception("Class %1$s not found: %2$s"); } > public function __call($m, $a) { throw new > AL_Exception("Class %1$s not found: %2$s"); } > public static function __callStatic($m, $a) { throw new > AL_Exception("Class %1$s not found: %2$s"); } > }', $class, $e->__toString())); > } > } > > which works best when __autoload() isn't triggered by class_exists("Foo", true)

Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
« previous php.internals (#38908) next »