|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-01-09 15:51 UTC] chris at kruining dot eu
-Summary: PHP 7.1.12-1 (Debian does not yet have 7.1.13
or 7.2.1)
+Summary: segfault when using spread operator on
generator passed by reference
-PHP Version: 7.1.13
+PHP Version: PHP 7.1.12-1 (Debian does not yet have 7.1.13
or 7.2.1)
[2018-01-09 15:51 UTC] chris at kruining dot eu
[2018-01-09 17:50 UTC] nikic@php.net
-Status: Open
+Status: Verified
[2018-01-09 17:50 UTC] nikic@php.net
[2018-01-09 19:25 UTC] nikic@php.net
[2018-01-09 19:25 UTC] nikic@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 20:00:01 2025 UTC |
Description: ------------ I've encountered this weird segfault it seems to be a combination of 'newer' techniques that goes wrong somewhere - iteration by reference :: demonstrated in the `Foo` class - array destruction :: at the end of the example - output :: all the var_dump's (both the locations and amount of var_dumps's seems to matter) I have no clue why this goes wrong, neither does the error log provide useful information(at least for me) php error log :: [Tue Jan 09 16:46:08.907851 2018] [proxy_fcgi:error] [pid 53058:tid 140258613700352] [client 192.168.198.88:55790] AH01067: Failed to read FastCGI header [Tue Jan 09 16:46:08.907896 2018] [proxy_fcgi:error] [pid 53058:tid 140258613700352] (104)Connection reset by peer: [client 192.168.198.88:55790] AH01075: Error dispatching request to : sys log :: Alert from syslog-ng Jan 9 16:46:08 remote kernel: [926537.733411] traps: php-fpm7.1[59524] general protection ip:55a832274080 sp:7ffca575e3d0 error:0 in php-fpm7.1[55a832036000+3d0000] I hope that I have provided enough information to be helpful :D Test script: --------------- <?php class Foo implements IteratorAggregate { protected $items = [ 'this', 'is', 'a', 'item', ]; public function &getIterator(): Generator { foreach($this->items as $key => &$value) { yield $key => $value; } unset($value); } } class Bar { public function doSomething(string $these, string $are, string $some, string $parameters): string { var_dump($these, $are, $some, $parameters); return 'success'; } } $data = [ new Bar, 'doSomething', new Foo, ]; foreach($data[2] as $key => &$value) { $value .= ' foo'; var_dump($value); } unset($value); // Some other code... [ $obj, $method, $arguments, ] = $data; var_dump($arguments, $obj->$method(...$arguments)); ?>