Bug #67266 [NEW]: array_merge exceeds maximum execution time
From: eithed at gmail dot com
Operating system: *
PHP version: 5.4.28
Package: *General Issues
Bug Type: Bug
Bug description:array_merge exceeds maximum execution time
Description:
------------
I've been working on updating the referenced array while in loop, when I
encountered an issue with array_merge - basically the code below will
run indefinitely. If you'll change the $value == 'a' to `$value ==
'b'` the code will successfully finish (the issue will occur for any
non-last element of array);
While array_merge doesn't solve my initial issue (as it seems to be
working on array copy), I don't think such behavior is valid.
Test script:
---------------
<?php
$array = array('a','b');
$t = &$array;
foreach($t as $value)
if ($value == 'a')
$t = array_merge($t, array('c'));
else
echo($value);
var_dump($array);
?>
Expected result:
----------------
b
array
0 => string 'a' (length=1)
1 => string 'b' (length=1)
2 => string 'c' (length=1)
Actual result:
--------------
Fatal error: Maximum execution time of 30 seconds exceeded
--
Edit bug report at https://bugs.php.net/bug.php?id=67266&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67266&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67266&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67266&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67266&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67266&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67266&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67266&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67266&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67266&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67266&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67266&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67266&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67266&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67266&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67266&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67266&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67266&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67266&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67266&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67266&r=mysqlcfg
Thread (3 messages)
- eithed at gmail dot com