#23524 [Opn->Ver]: Improper handling of constants in array indeces.
| From: | sniper@php.net | Date: | Wed, 14 May 2003 01:09:49 +0000 |
| Subject: | #23524 [Opn->Ver]: Improper handling of constants in array indeces. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-39588@lists.php.net to get a copy of this message | ||
ID: 23524
Updated by: sniper@php.net
Reported By: d dot stogov at turck dot spb dot ru
-Status: Open
+Status: Verified
Bug Type: Scripting Engine problem
Operating System: Any
-PHP Version: 4.3.1
+PHP Version: 4.3.2-RC3-dev
Previous Comments:
------------------------------------------------------------------------
[2003-05-07 04:03:09] d dot stogov at turck dot spb dot ru
This bug exists in PHP version 4.1.2 - 4.3.1 and 5.0.0-dev.
It is similar to bug #18872 (Improper handling of class constants used
as default function argument values).
See the following PHP code:
<?php
function f($a=array(PHP_VERSION=>PHP_VERSION)) {
print_r($a);
echo "<br>\n";
}
f();
f();
?>
The function "f" should print the same result at first and at second
invocation but it is not true. The output is:
Array
(
[4.3.1] => 4.3.1
)
<br>
Array
(
[PHP_VERSION] => 4.3.1
)
<br>
The error is in handling of "ZEND_RECV_INIT" opcode and in
function "zval_update_constant" that resets "IS_CONSTANT_INDEX" flag in
original "zval" instead of copy.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23524&edit=1