php / php/php-src

do_operation ZEND_BOOL_NOT not invoked

未关闭
#13,867 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

The object handler do_operation is not invoked for the opcode ZEND_BOOL_NOT.

With the supporting code for PHP 8.2 ext/zend_test https://github.com/ranvis/php-src/commit/2c542eef94de90b20b6e8d86ebeafee5408b12c9,
the following code:

<?php
$a = new DoOperationNoCast(5);
var_dump(!$a);

Resulted in this output:

bool(false)

But I expected this output instead:

object(DoOperationNoCast)#2 (1) {
  ["val":"DoOperationNoCast":private]=>
  int(0)
}

The code !$obj is evaluated as !(bool)$obj instead.
This appears to have been introduced on PHP 7.0, the commit https://github.com/php/php-src/commit/e6180ebb640408c7ded804f5f65282122a059ddb.

PHP Version

dev-PHP-8.2

Operating System

irrelevant

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先追踪 PHP 解释器对 ZEND_BOOL_NOT opcode 和对象处理器 do_operation 的处理,并以 ext/zend_test 支持代码和链接的 PHP 7.0 更改作为上下文。在 PHP 8.2 上运行提供的 DoOperationNoCast 示例,并验证处理器确实被调用,且结果与预期的对象输出一致。

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

评估

技术栈
c, php
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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