Bug #73792 [Ver->Csd]: invalid foreach loop hangs script

From: Date: Tue, 20 Dec 2016 13:54:40 +0000
Subject: Bug #73792 [Ver->Csd]: invalid foreach loop hangs script
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206156@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73792&edit=1 ID: 73792 Updated by: dmitry@php.net Reported by: ryan dot brothers at gmail dot com Summary: invalid foreach loop hangs script -Status: Verified +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 7.0 Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=3c6a2fb08cb8c0dddc16a62a816249c68132773d Log: Fixed bug #73792 (invalid foreach loop hangs script) Previous Comments: ------------------------------------------------------------------------ [2016-12-20 12:06:39] requinix@php.net 3v4l doesn't like it since 7.0. https://3v4l.org/YhlXN On Windows, PHP 7.0.9 crashes (not responding) but 7.1.0 gives Warning: Illegal string offset 'bbb' in - on line 4 Fatal error: Uncaught Error: Cannot return string offsets by reference in -:4 Stack trace: #0 {main} thrown in - on line 4 ------------------------------------------------------------------------ [2016-12-20 11:54:54] ryan dot brothers at gmail dot com Description: ------------ When running the below in PHP 7.1.0, the foreach loop hangs the script, and my CPU goes to 100% utilization. If &$value is changed to $value, then it runs cleanly. Test script: --------------- <?php $a = 'aaa'; foreach ($a['bbb'] as &$value) { echo 'loop'; } unset($value); echo 'done'; Expected result: ---------------- Warning: Illegal string offset 'bbb' in /tmp/test.php on line 4 Warning: Invalid argument supplied for foreach() in /tmp/test.php on line 4 done Actual result: -------------- Warning: Illegal string offset 'bbb' in /tmp/test.php on line 4 then it hangs ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73792&edit=1

« previous php.bugs (#206156) next »