php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50335 array_unshift can only run 1965 times
Submitted: 2009-11-30 15:11 UTC Modified: 2009-12-08 01:00 UTC
From: ryan at ongawari dot com Assigned:
Status: No Feedback Package: Arrays related
PHP Version: 5.3.1 OS: Win 2008
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ryan at ongawari dot com
New email:
PHP Version: OS:

 

 [2009-11-30 15:11 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-30 15:38 UTC] 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 16:04 UTC] jani@php.net
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.
 [2009-12-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC