php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50741 Midsized array of objects with arrays cause crash
Submitted: 2010-01-13 17:36 UTC Modified: 2010-01-14 08:13 UTC
From: thorsten dot engel at matrix-computer dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.3.2RC1 OS: Win32+Gentoo Linux
Private report: No CVE-ID: None
 [2010-01-13 17:36 UTC] thorsten dot engel at matrix-computer dot com
Description:
------------
Hi,

we love php and tried to migrate from 5.2.11 to 5.3.1 and found a "crash" when using midsize array of objects (nesting level=2). This problem does not exist on 5.2.4, 5.2.6, 5.2.11, but exists ins 5.3.0, 5.3.1 and 5.3.2RC1. We could reproduce it as well on win32 and on linux.

It crashed in our case at around 10.000 on win32 and around 7600 on linux.

It would be great if you guys can reproduce this as well!

Warm regards,

Thorsten



Reproduce code:
---------------
class test
{
	protected $_a = array();
	protected $_b = array();
	protected $_i = array();

	public function __construct($a,$b)
	{
		$this->_a = (array) $a;
		$this->_b = (array) $b;
		$this->_i = array();

		if (count($a) == 0)
		{
			for ($i=0;$i<10;$i++)
				$this->_i[$i] = new test(array('1','2'), array());
		}
	}
}

$s = array();

for ($i=0;$i<15000;$i++)
{
	print $i.'<br>';
	$x = new test(array(),array());
	$s[] = $x;
}

Expected result:
----------------
completing with 15.000 lines.

Actual result:
--------------
crashing after 7.000 until 10.000 lines.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-13 17:41 UTC] rasmus@php.net
Unable to reproduce here.  What do you mean by crash?  Memory is 
tracked more accurately in PHP 5.3 so if you are hitting your 
configured memory limit, that's not a bug.  Run it without a memory 
limit.
 [2010-01-14 08:13 UTC] thorsten dot engel at matrix-computer dot com
Thanks, you *are right*. I only had 250MB as memory ;-).

With your help I could narrow down this problem to a "__PHP_Incomplete_Class_Name" in the session that seems to cause this problem. I'll investigate this now.

Thanks for your help.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 00:01:36 2025 UTC