php / php/php-src

PHP 8.2.0 access violation while executing a 'foreach' loop

Offen
#10,067 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bug Category: JIT Status: Needs Triage
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

Description

Encountered an access violation bug in PHP 8.2.0 while executing a foreach loop on an array. It's inside a complex PHP application. Unfortunateley, I cannot reproduce the error with a small extract of the code just with the loop. Using the extract, it works :-\

I added the extract also to here. But, might not help much as it works. I assigned the variables for the loop with the same values just before the loop which crashes. Background: Application is a house automation server. Loop creates the commands for an i2c command.

What I see:

  • The loop just stops before all array elements are executed and PHP exits immediately without calling any error- or exit-handler. The last command in the loop is executed. The next element is not retrieved. The loop is successfully executed ~10 times. In the next attempt, PHP crashes
  • No message is written to the prompt
  • No entry in the PHP error log is created (all error reporting is enabled)
  • A windows access violation event is created. See attachment (partly in German; hope thats not a problem)
  • It workes without errors in PHP 8.1.13 (cli) (built: Nov 22 2022 15:49:14) (ZTS Visual C++ 2019 x64)

If I can provide more information, just advise me.

PHP_8.2.0_Crash.txt
PHP_8.2.0_Crash_php.txt

PHP Version

PHP 8.2.0 (cli) (built: Dec 6 2022 15:31:23) (ZTS Visual C++ 2019 x64) - from windows.php.net

Operating System

Windows 10 22H2 Build 19045.2311

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der Durchsicht von PHP_8.2.0_Crash_php.txt und PHP_8.2.0_Crash.txt und führen Sie anschließend das bereitgestellte Extract unter PHP 8.2.0 und 8.1.13 auf Windows aus, um den Unterschied zu bestätigen. Für den Fortschritt muss der komplexe foreach-Fehler auf einen reproduzierbaren Fall reduziert werden; abgeschlossen ist die Arbeit, wenn die Zugriffsverletzung reproduziert werden kann und ihre Ursache oder Behebung geklärt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
18/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.