From:             php at tfwasmus dot enschedenet dot nl
Operating system: Windows Xp x64
PHP version:      5CVS-2007-07-30 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  Operator Precedence: postincrement before '['

Description:
------------
According to the operator precedence
(http://www.php.net/manual/en/language.operators.php#language.operators.precedence),
a (post)increment should be evalued after the '['.

It seems that isn't true in assigning to an array in PHP5 anymore, while
it was in PHP4. Latest snapshots of both checked (30-07-2007).

This could also be a documentation problem.

Reproduce code:
---------------
<?php
$k = 1;
$a = array();
$a[$k] = $k++;
var_dump($a,$k);
?>

Expected result:
----------------
array(1) {
  [1]=>
  int(1)
}
int(2)

Actual result:
--------------
array(1) {
  [2]=>
  int(1)
}
int(2)

-- 
Edit bug report at http://bugs.php.net/?id=42152&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42152&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42152&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42152&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42152&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42152&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42152&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42152&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42152&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42152&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42152&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42152&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42152&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42152&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42152&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42152&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42152&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42152&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42152&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42152&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42152&r=mysqlcfg

Reply via email to