#18872 [Ver->Csd]: Improper handling of class constants used as default function argument values
| From: | stas@php.net | Date: | Sun, 15 Jun 2003 14:42:48 +0000 |
| Subject: | #18872 [Ver->Csd]: Improper handling of class constants used as default function argument values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-41942@lists.php.net to get a copy of this message | ||
ID: 18872
Updated by: stas@php.net
Reported By: optikSmoke at subdimension dot com
-Status: Verified
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: Mandrake 8.2 (linux 2.4.18)
PHP Version: 5.0.0-dev
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-08-12 23:27:03] optikSmoke at subdimension dot com
I am using CVS from August 12, compiled with Zend2, as a
module in Apache 1.3.23. My problem is this: When I use a
class constant as the default value to an argument in a
function, the first time I call the function (omitting the
argument), PHP correctly uses the value of the constant
for the value of the omitted argument. The second time I
call the same function (again omitting the argument), PHP
uses a slightly-garbled form of the name of the class
constant, instead of the value of the constant. For
example:
<?
class FooBar {
const BIFF = 3;
}
function foo($biff = FooBar::BIFF) {
echo $biff . "\n";
}
foo();
foo();
?>
The expected output of this is (obviously):
3
3
The output I get is:
3
foobar :BIFF
(The space before ":BIFF" should be a non-printing
character, rendered as a box on my system, but I'm not
sure if it will come through properly :)
This error does not occur when using regular "define()'d"
constants. For example, if I replaced FooBar::BIFF with a
constant BIFF, I get the expected output (no garbled
constant names, "3" is displayed by each call to foo()).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18872&edit=1