ID: 18872
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Verified
Bug Type: Zend Engine 2 problem
Operating System: Mandrake 8.2 (linux 2.4.18)
PHP Version: 4CVS-2002-08-12
Previous Comments:
------------------------------------------------------------------------
[2002-08-12 23:27:03] [EMAIL PROTECTED]
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