#50335 [Fbk->Opn]: array_unshift can only run 1965 times

From: Date: Mon, 30 Nov 2009 15:38:27 +0000
Subject: #50335 [Fbk->Opn]: array_unshift can only run 1965 times
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145227@lists.php.net to get a copy of this message
ID: 50335 User updated by: ryan at ongawari dot com Reported By: ryan at ongawari dot com -Status: Feedback +Status: Open Bug Type: Arrays related Operating System: Win 2008 PHP Version: 5.3.1 New Comment: <?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); ?> Previous Comments: ------------------------------------------------------------------------ [2009-11-30 15:14:18] jani@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [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

« previous php.bugs (#145227) next »