#50335 [Opn->Fbk]: array_unshift can only run 1965 times
ID: 50335
Updated by: jani@php.net
Reported By: ryan at ongawari dot com
-Status: Open
+Status: Feedback
Bug Type: Arrays related
Operating System: Win 2008
PHP Version: 5.3.1
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
The script provided works fine for me using latest SVN checkout.
Previous Comments:
------------------------------------------------------------------------
[2009-11-30 15:38:27] ryan at ongawari dot com
<?php
function addrownumbers(&$dataarray) {
$numrows = count($dataarray);
for ($i = 0; $i < $numrows; ++$i)
array_unshift($dataarray[$i],($i+1));
}
$dataarray=array();
for($j=0;$j<8000;++$j)
for($k=0;$k<8;++$k)
$dataarray[$j][$k]=rand(0,10000);
addrownumbers($dataarray);
?>
------------------------------------------------------------------------
[2009-11-30 15:11:27] ryan at ongawari dot com
Description:
------------
array_unshift can only run 1965 times
Reproduce code:
---------------
for ($i=0;$i<$numrows;++$i) {
array_unshift($dataarray[$i],($i+1));
}
Expected result:
----------------
To prepend the 2d array with a column that represents the row number of
the 2D array
Actual result:
--------------
Apache crashes at line 1965 (when $i=1965)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50335&edit=1
Thread (4 messages)