Bug #74157 [NEW]: Segfault with nested generators

From: Date: Thu, 23 Feb 2017 20:17:24 +0000
Subject: Bug #74157 [NEW]: Segfault with nested generators
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207526@lists.php.net to get a copy of this message
From: tom at inflatablecookie dot com Operating system: OSX Sierra 10.12.3 PHP version: 7.1.2 Package: opcache Bug Type: Bug Bug description:Segfault with nested generators Description: ------------ Upgrading to 7.1.2 has introduced a regular segfault when using nested generators - I'm assuming it was introduced with the following from the changelog: -Improved GENERATOR_CREATE opcode handler. This happens regardless of platform (tested on OSX Sierra and Ubuntu), and regardless of extensions enabled (still occurs with all available extensions disabled). As of now, I'm struggling to come up with a decent test script as the real-world scenario leverages a significant amount of user code, however the segfault always occurs upon entry to a generator function called after a certain number of nested generators have successfully run. I'll update once I can replicate in a simple test environment. The basic premise of the code is to generate html tags - the tag object takes a generator as argument which yields string or object contents, which generally includes more tag objects with their own generator, etc. Actual result: -------------- Here's the backtrace (from OSX console) 0 0x000000010754cb01 zend_generator_close + 326 1 0x00000001075a9e90 ZEND_GENERATOR_RETURN_SPEC_CONST_HANDLER + 51 2 0x0000000107561d3e execute_ex + 44 3 0x000000010754d3b5 zend_generator_resume + 377 4 0x000000010757e877 ZEND_FE_FETCH_R_SPEC_VAR_HANDLER + 346 5 0x0000000107561d3e execute_ex + 44 6 0x00000001075157d4 zend_call_function + 1468 7 0x000000010753f7ad zend_call_method + 581 8 0x000000010755a3b7 zend_std_cast_object_tostring + 314 9 0x000000010751acb1 _zval_get_string_func + 381 10 0x00000001075724e0 ZEND_ECHO_SPEC_TMPVAR_HANDLER + 69 11 0x0000000107561d3e execute_ex + 44 12 0x0000000107561fb6 zend_execute + 551 13 0x0000000107523e94 zend_execute_scripts + 299 14 0x00000001074cb7e8 php_execute_script + 804 15 0x00000001075c9582 main + 6286 16 0x00007fff98117255 start + 1 -- Edit bug report at https://bugs.php.net/bug.php?id=74157&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74157&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74157&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74157&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74157&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74157&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74157&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74157&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74157&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74157&r=support Expected behavior: https://bugs.php.net/fix.php?id=74157&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74157&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74157&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74157&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74157&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74157&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74157&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74157&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74157&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74157&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74157&r=mysqlcfg

« previous php.bugs (#207526) next »