Bug #67266 [Opn]: array_merge exceeds maximum execution time

From: Date: Fri, 08 Jan 2016 22:17:07 +0000
Subject: Bug #67266 [Opn]: array_merge exceeds maximum execution time
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198535@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67266&edit=1 ID: 67266 Updated by: tpunt@php.net Reported by: eithed at gmail dot com Summary: array_merge exceeds maximum execution time Status: Open Type: Bug Package: *General Issues Operating System: * PHP Version: 5.4.28 Block user comment: N Private report: N New Comment: This appears to be fixed in PHP 7: https://3v4l.org/T37UF Previous Comments: ------------------------------------------------------------------------ [2014-05-13 15:45:23] eithed at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=67266&edit=1

« previous php.bugs (#198535) next »