php / php/php-src

PHP 8.2.0 access violation while executing a 'foreach' loop

未关闭
#10,067 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Category: JIT Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先检查 PHP_8.2.0_Crash_php.txt 和 PHP_8.2.0_Crash.txt,然后在 Windows 上使用 PHP 8.2.0 和 8.1.13 运行所提供的 extract,以确认差异。要取得进展,必须将复杂的 foreach 失败缩减为可复现的案例;完成的标准是能够复现访问冲突,并确定其原因或修复方法。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
backend
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
18/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。