- 实现了对原生类型静态属性的引用管理机制 - 为整型和浮点型静态属性创建稳定的 zval* 槽位 - 添加了静态属性引用信息的条件检查和初始化逻辑 - 更新了静态属性访问的帮助函数选择机制 - 修改了变量声明生成以统一使用 zval* 类型 - 优化了头文件包含的代码生成格式 - 添加了相关的单元测试验证对象属性操作收集 - 新增了静态属性引用槽崩溃场景的测试用例pull/3/head
parent
ad617bcac8
commit
e4e63e7b8c
6 changed files with 83 additions and 5 deletions
@ -0,0 +1,26 @@ |
||||
--TEST-- |
||||
Static property native slot becomes invalid after dynamic reference binding |
||||
--FILE-- |
||||
<?php |
||||
use native_types; |
||||
|
||||
class StaticRefSlotCrash { |
||||
public static int $i = 1; |
||||
} |
||||
|
||||
function main(): void { |
||||
StaticRefSlotCrash::$i = 12; |
||||
|
||||
var_dump(StaticRefSlotCrash::$i); |
||||
eval('function bind_static_ref(): void { $ref =& StaticRefSlotCrash::$i; $ref = 99; }'); |
||||
bind_static_ref(); |
||||
|
||||
var_dump(StaticRefSlotCrash::$i); |
||||
StaticRefSlotCrash::$i += 1; |
||||
var_dump(StaticRefSlotCrash::$i); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
int(12) |
||||
int(99) |
||||
int(100) |
||||
@ -0,0 +1,24 @@ |
||||
--TEST-- |
||||
Static float property native slot becomes invalid after dynamic reference binding |
||||
--FILE-- |
||||
<?php |
||||
use native_types; |
||||
|
||||
class StaticFloatRefSlotCrash { |
||||
public static float $f = 1.5; |
||||
} |
||||
|
||||
function main(): void { |
||||
StaticFloatRefSlotCrash::$f = 1.5; |
||||
|
||||
eval('function bind_static_float_ref(): void { $ref =& StaticFloatRefSlotCrash::$f; $ref = 9.5; }'); |
||||
bind_static_float_ref(); |
||||
|
||||
var_dump(StaticFloatRefSlotCrash::$f); |
||||
StaticFloatRefSlotCrash::$f += 0.5; |
||||
var_dump(StaticFloatRefSlotCrash::$f); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
float(9.5) |
||||
float(10) |
||||
Loading…
Reference in new issue