Ask a Question related to PHP Bugs, Design and Development.
-
johannes@php.net #1
#38465 [Asn->Csd]: ReflectionParameter fails if default value is an access to self::
ID: 38465
Updated by: [email]johannes@php.net[/email]
Reported By: baldurien at bbnwn dot eu
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.1.4
Assigned To: johannes
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
[url]http://snaps.php.net/[/url].
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-08-15 10:55:25] baldurien at bbnwn dot eu
Description:
------------
While it is possible to use a class constant as default parameter, and
while it is possible to use in the form of "self::X", this does not
work when we try to reflect such parameter (see below).
It was tested with php5.1.4 (my default version),
php5.2-win32-200608150830, and php6.0-win32-200608150830.
If using a class constant as a default parameter is not possible, then
it should be said in the doc :
[url]http://fr.php.net/manual/en/language.oop5.paamayim-nekudotayim.php[/url]
Don't not say much.
Reproduce code:
---------------
class Foo {
const X = 1;
public function x($x = self::X) {}
}
$clazz = new ReflectionClass('Foo');
$method = $clazz->getMethod('x');
foreach ($method->getParameters() as $param) {
if ( $param->isDefaultValueAvailable())
echo '$', $param->getName(), ' : ', $param->getDefaultValue(),
"\n";
}
Expected result:
----------------
should work, eg: display $x = 1
Actual result:
--------------
Fatal error: Cannot access self:: when no class scope is active in
D:\documents\xxx\desktop\php6.0-win32-200608150830\truc.php on line 10
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=38465&edit=1[/url]
johannes@php.net Guest
-
#39884 [NEW]: ReflectionParameter::getClass() throws exception for type hint self
From: bugs at php dot frankkleine dot de Operating system: PHP version: 5.2.0 PHP Bug Type: Unknown/Other Function Bug... -
Default user access rights in Vista
I've had four people using Vista beta test my software and all three have reported problems related to not being able to write to the application... -
load default FLV is loadVideo fails? how to detecterror?
how can i detect a loading error and then load a default video? or Detect if a file exist on server ?? How to please thanks. -
mySQL datetime field default now() fails
I have a mySQL database table with a column field datatype of datetime that I set up in the original create table statement like this: create... -
Web Access Fails
I am running IIS 5.1 on Windows XP Pro but keep failing due to the message below. Please help! "When you create a Web Application in Microsoft...



Reply With Quote

