- 新增 class const 001 测试用例验证 AOT 编译功能 - 在返回值处理后添加 php::deref(return_value) 确保正确解引用 - 修复了函数返回值可能存在的内存引用问题 - 测试用例覆盖了数组排序和引用传递场景pull/1/head
parent
ee3dbc9717
commit
9d9556929f
2 changed files with 46 additions and 0 deletions
@ -0,0 +1,45 @@ |
||||
--TEST-- |
||||
class const 001 |
||||
--FILE-- |
||||
<?php |
||||
class WorkerA |
||||
{ |
||||
public function foo(): array { |
||||
} |
||||
|
||||
public function sort(array &$list) { |
||||
sort($list); |
||||
} |
||||
|
||||
public function run() { |
||||
return $this->foo(); |
||||
} |
||||
} |
||||
|
||||
class WorkerB extends WorkerA |
||||
{ |
||||
public function foo(): array { |
||||
$list = [377, 64, 688, 2]; |
||||
$ref = &$list; |
||||
$this->sort($ref); |
||||
return $list; |
||||
} |
||||
} |
||||
|
||||
function main() |
||||
{ |
||||
$o = new WorkerB; |
||||
var_dump($o->run()); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
array(4) { |
||||
[0]=> |
||||
int(2) |
||||
[1]=> |
||||
int(64) |
||||
[2]=> |
||||
int(377) |
||||
[3]=> |
||||
int(688) |
||||
} |
||||
Loading…
Reference in new issue