Bug #81512 [NEW]: Unexpected behavior with arrays and JIT

From: Date: Thu, 07 Oct 2021 13:55:16 +0000
Subject: Bug #81512 [NEW]: Unexpected behavior with arrays and JIT
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237088@lists.php.net to get a copy of this message
From: timuradilev at gmail dot com Operating system: Ubuntu 20.04.3 PHP version: 8.0.11 Package: JIT Bug Type: Bug Bug description:Unexpected behavior with arrays and JIT Description: ------------ We migrated from php 7.4 to 8 and encountered an issue. In mongodb/mongo-php-library there is the function 'is_pipeline' that checks that the given argument is the correct pipeline. This function started to return false for correct pipelines. I reduced the function. See the test script section. To reproduce the behavior run the test script with opcache.enable_cli=1 and opcache.jit=tracing. Optimization flags 0052 also trigger the issue. We think it may be due to the "Inline VM handlers" option. Test script: --------------- $pipe = [['val1'],['val2'],]; for ($i = 0; $i < 30; ++$i) { echo "$i "; if (!is_pipeline($pipe)) { echo 'ERROR '; } } function is_pipeline($pipeline): bool { foreach ($pipeline as $stage) { if (!is_array($stage)) { return false; // must never happen } $stage = (array) $stage; reset($stage); } return true; } Expected result: ---------------- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Actual result: -------------- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ERROR 22 ERROR 23 ERROR 24 ERROR 25 ERROR 26 ERROR 27 ERROR 28 ERROR 29 ERROR -- Edit bug report at https://bugs.php.net/bug.php?id=81512&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81512&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81512&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81512&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81512&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81512&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81512&r=support Expected behavior: https://bugs.php.net/fix.php?id=81512&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81512&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81512&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81512&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81512&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81512&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81512&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81512&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81512&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81512&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81512&r=mysqlcfg

« previous php.bugs (#237088) next »