|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-06-15 09:42 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 04:00:01 2025 UTC |
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()).