Bug #81512 [Opn->Asn]: Unexpected behavior with arrays and JIT

From: Date: Thu, 07 Oct 2021 14:10:17 +0000
Subject: Bug #81512 [Opn->Asn]: Unexpected behavior with arrays and JIT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237089@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81512&edit=1 ID: 81512 Updated by: nikic@php.net Reported by: timuradilev at gmail dot com Summary: Unexpected behavior with arrays and JIT -Status: Open +Status: Assigned Type: Bug Package: JIT Operating System: Ubuntu 20.04.3 PHP Version: 8.0.11 -Assigned To: +Assigned To: dmitry Block user comment: N Private report: N New Comment: I can reproduced on 8.0 but not on 8.1. Previous Comments: ------------------------------------------------------------------------ [2021-10-07 13:55:16] timuradilev at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=81512&edit=1

« previous php.bugs (#237089) next »