[php-src] Issue #8133: Contants in Enum classes causes php-fpm worker to segfault

From: Date: Mon, 21 Feb 2022 23:40:45 +0000
Subject: [php-src] Issue #8133: Contants in Enum classes causes php-fpm worker to segfault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239954@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8133 Author: alshenetsky ### Description I have such class: ```php <?php namespace App\Domain\TournamentTable; enum ResultsModifier { case HOME; case AWAY; case OVERTIME; case REGULATION_TIME; case OVERALL; public const SPECIAL_MODIFIERS = [ ResultsModifier::AWAY, ResultsModifier::HOME, ResultsModifier::OVERTIME, ResultsModifier::REGULATION_TIME, ]; } ``` When I use this constant in a loop in another class, the php-worker crashes ``` foreach (ResultsModifier::SPECIAL_MODIFIERS as $modifier) { // segfault ``` Output: ``` [21-Feb-2022 23:28:26] WARNING: [pool www] child 46 exited on signal 11 (SIGSEGV) after 3.227291 seconds from start ``` The same code works if I: 1. turn off opcache (opcache.enable = 0) 2. remove reference to the constant: ``` foreach ([ResultsModifier::AWAY, ResultsModifier::HOME, ResultsModifier::OVERTIME, ResultsModifier::REGULATION_TIME] as $modifier) { // works as expected ``` So it probably a bug with opcache. ### PHP Version PHP 8.1.3 ### Operating System Alpine 3.13

« previous php.bugs (#239954) next »