#23524 [NEW]: Improper handling of constants in array indeces.
| From: | d dot stogov at turck dot spb dot ru | Date: | Wed, 07 May 2003 09:03:09 +0000 |
| Subject: | #23524 [NEW]: Improper handling of constants in array indeces. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-39212@lists.php.net to get a copy of this message | ||
From: d dot stogov at turck dot spb dot ru
Operating system: Any
PHP version: 4.3.1
PHP Bug Type: Scripting Engine problem
Bug description: Improper handling of constants in array indeces.
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 bug report at http://bugs.php.net/?id=23524&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23524&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23524&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23524&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23524&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23524&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23524&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23524&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23524&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23524&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23524&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23524&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23524&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23524&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23524&r=gnused