From:             felipensp at gmail dot com
Operating system: Linux
PHP version:      5.3CVS-2007-11-01 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  Odd array behavior

Description:
------------
See the result of code.

Reproduce code:
---------------
<?php

$a = range(1,10);
foreach ($a as &$b) {
  // normal
  # $a[0] = $a;   
  
  // keys: 1,2,3 - seg. fault
  # $a[1] = $a;  
  
  // odd result
  $a[4] = $a;    
   
  //5... - seg. fault                 
} 

var_dump($a);


Actual result:
--------------
Keys:
- Normal: 0
- Seg. fault: 1,2,3,5... (this isn't a bug, right?)
- Odd: 4

array(10) {
  [0]=>
  int(139421480)
  [1]=>
  int(2)
  [2]=>
  int(139421820)
  [3]=>
  int(139421252)
  [4]=>
  &array(10) {
    [0]=>
    int(139421480)
    [1]=>
    int(2)
    [2]=>
    int(139421820)
    [3]=>
    int(139421252)
    [4]=>
    &array(10) {
      [0]=>
      int(139421480)
      [1]=>
      int(2)
      [2]=>
      int(139421820)
      [3]=>
      int(139421252)
      [4]=>
      *RECURSION*
      [5]=>
      &int(139421480)
      [6]=>
      int(139421752)
      [7]=>
      int(139421616)
      [8]=>
      NULL
      [9]=>
      &int(139421480)
    }
    [5]=>
    &int(139421480)
    [6]=>
    int(139421752)
    [7]=>
    int(139421616)
    [8]=>
    NULL
    [9]=>
    &int(139421480)
  }
  [5]=>
  &int(139421480)
  [6]=>
  int(139421752)
  [7]=>
  int(139421616)
  [8]=>
  NULL
  [9]=>
  &int(139421480)
}


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

Reply via email to