Change in variable assignment behavior as argument
未关闭
还没有人认领这个 Issue。
Bug
Category: Engine
Status: Verified
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?php
$text = 'abc';
$offset = 0;
$char = substr($text, $offset, $offset = strpos($text, 'b', $offset));
var_dump($char);
Resulted in this output with PHP 8.2.31 :
string(1) "a"
Resulted in this output with PHP 8.4.21 :
string(1) "b"
PHP Version
PHP 8.2.31 (cli) (built: May 8 2026 07:20:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.31, Copyright (c) Zend Technologies
with Zend OPcache v8.2.31, Copyright (c), by Zend Technologies
PHP 8.4.21 (cli) (built: May 8 2026 05:56:48) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.21, Copyright (c) Zend Technologies
with Zend OPcache v8.4.21, Copyright (c), by Zend Technologies
Operating System
PHP 8.2.31 : Debian 12.14 - PHP 8.4.21 : Debian 13.5
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 PHP 8.2.31 和 8.4.21 上复现该示例,然后跟踪不同版本中参数求值以及对 $offset 的赋值有何差异。确定哪个结果符合 PHP 预期的语义,并在为该示例添加回归覆盖之前,识别相关的解释器行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100