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?
[EMAIL PROTECTED]:~ > 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()
));
}
?>
[EMAIL PROTECTED]:~ > 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
[EMAIL PROTECTED]:~ > 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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php