Bug #77216 [Com]: recursive generator crash PHP

From: Date: Wed, 28 Nov 2018 23:07:08 +0000
Subject: Bug #77216 [Com]: recursive generator crash PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218196@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77216&edit=1 ID: 77216 Comment by: spam2 at rhsoft dot net Reported by: dams@php.net Summary: recursive generator crash PHP Status: Re-Opened Type: Bug Package: Reproducible crash Operating System: Irrelevant PHP Version: 7.3.0RC6 Block user comment: N Private report: N New Comment: EVERY uncontrolled crash is a bug - it's that simple Previous Comments: ------------------------------------------------------------------------ [2018-11-28 23:05:02] cmb@php.net This is a stack overflow caused by infinite recursion of execute_ex(). I doubt that we can catch such issues without measurable performance impact. Also, Xdebug has xdebug.max_nesting_level[1] which should catch such issues during development. See also bug #69424. In my opinion, this is not a bug. [1] <https://xdebug.org/docs/basic> ------------------------------------------------------------------------ [2018-11-28 22:31:43] kalle@php.net @requinix, despite this being an infinite recursion, it should not crash but instead it should throw a memory_limit error, so keeping it open. Similar to other bugs I have reported in the past ------------------------------------------------------------------------ [2018-11-28 22:17:51] requinix@php.net That's just plain infinite recursion. Recursive generators work fine. https://3v4l.org/Hd0OE ------------------------------------------------------------------------ [2018-11-28 21:58:41] dams@php.net Description: ------------ When a generator calls itself (what an idea), PHP crashes. Test script: --------------- <?php function generator($n) { foreach(generator($n) as $l) { yield $l; } } foreach(generator(10) as $l) { print $l; } // Also https://3v4l.org/8FXB3 Expected result: ---------------- No crash, please. Can I ask for recursive generators? No? Well, A warning or a nice fail will do. Actual result: -------------- Segmentation fault: 11 On OSX Process exited with code 139. On linux. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77216&edit=1

« previous php.bugs (#218196) next »