PHP 8.2.0 access violation while executing a 'foreach' loop
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing PHP_8.2.0_Crash_php.txt and PHP_8.2.0_Crash.txt, then run the supplied extract under PHP 8.2.0 and 8.1.13 on Windows to confirm the difference. Progress requires reducing the complex foreach failure to a reproducible case; done means the access violation can be reproduced and its cause or fix is established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100