Re: reflection API bug or change?

From: Date: Tue, 23 Dec 2003 20:11:13 +0000
Subject: Re: reflection API bug or change?
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-6709@lists.php.net to get a copy of this message
On Mon, 2003-12-22 at 16:05, Hans Lellelid wrote: > Hi - > > We're using the Reflection API in a project for which I'm lead developer. > Seems to be something changed between beta-2 and beta-3. We're now > getting the following exception when calling getClass() on a class hint: [...] Works fine here (see below), care to provide a small reproducing script? thekid@friebes:~ > cat reflection_parameter_test.php <?php class FileSet { public function test($set) { } } $method= new Reflection_Method('FileSet', 'test'); $params= $method->getParameters(); var_dump( $params[0]->getClass(), $method->getName(), $method->getDeclaringClass()->getName() ); if (NULL === ($hint= $params[0]->getClass())) { throw new Exception(sprintf( '%s::%s() method MUST use a class hint...', $method->getDeclaringClass()->getName(), $method->getName() )); } ?> thekid@friebes:~ > php-dev reflection_parameter_test.php NULL string(4) "test" string(7) "FileSet" Fatal error: Uncaught exception 'exception' with message 'FileSet::test() method MUST use a class hint...' in /usr/home/thekid/reflection_parameter_test.php:16 Stack trace: #0 {main} thrown in /usr/home/thekid/reflection_parameter_test.php on line 16 thekid@friebes:~ > php-dev -v PHP 5.0.0RC1-dev (cli) (built: Dec 23 2003 20:51:13) (DEBUG) Copyright (c) 1997-2003 The PHP Group Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies - Timm

« previous php.internals (#6709) next »