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

From: Date: Tue, 20 Dec 2016 12:06:41 +0000
Subject: Bug #73792 [Opn->Ver]: invalid foreach loop hangs script
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206153@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: requinix@php.net Reported by: ryan dot brothers at gmail dot com Summary: invalid foreach loop hangs script -Status: Open +Status: Verified Type: Bug Package: Scripting Engine problem Operating System: Linux -PHP Version: 7.1.0 +PHP Version: 7.0 Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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 (#206153) next »