Skip to content

PHP 8.2.0 access violation while executing a 'foreach' loop #10067

Open
@mdrmdrmdr

Description

@mdrmdrmdr

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions