- 添加 bug #24499 测试用例,验证公共属性被误处理为私有属性的问题 - 添加 bug #24652 测试用例,修复 array_flip 函数的 broken 问题 - 添加 bug #24908 测试用例,解决超全局变量在 __destruct 中无法使用的问题 - 添加 bug #55754 测试用例,修复 ZEND_SEND_PREFER_REF 参数的引用传递问题 - 修复 CompilerBase.php 中全局变量解析逻辑,确保变量名正确转义pull/1/head
parent
8312de6c73
commit
e1fd716e03
5 changed files with 93 additions and 1 deletions
@ -0,0 +1,27 @@ |
|||||||
|
--TEST-- |
||||||
|
Bug #24499 (bogus handling of a public property as a private one) |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
class Id { |
||||||
|
private $id="priv"; |
||||||
|
|
||||||
|
public function tester($obj) |
||||||
|
{ |
||||||
|
$obj->id = "bar"; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() { |
||||||
|
$id = new Id(); |
||||||
|
$obj = new stdClass; |
||||||
|
$obj->foo = "bar"; |
||||||
|
$id->tester($obj); |
||||||
|
print_r($obj); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
stdClass Object |
||||||
|
( |
||||||
|
[foo] => bar |
||||||
|
[id] => bar |
||||||
|
) |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
--TEST-- |
||||||
|
Bug #24652 (broken array_flip()) |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
/* This works */ |
||||||
|
$f = array('7' => 0); |
||||||
|
var_dump($f); |
||||||
|
var_dump(array_key_exists(7, $f)); |
||||||
|
var_dump(array_key_exists('7', $f)); |
||||||
|
|
||||||
|
print "----------\n"; |
||||||
|
/* This doesn't */ |
||||||
|
$f = array_flip(array('7')); |
||||||
|
var_dump($f); |
||||||
|
var_dump(array_key_exists(7, $f)); |
||||||
|
var_dump(array_key_exists('7', $f)); |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
array(1) { |
||||||
|
[7]=> |
||||||
|
int(0) |
||||||
|
} |
||||||
|
bool(true) |
||||||
|
bool(true) |
||||||
|
---------- |
||||||
|
array(1) { |
||||||
|
[7]=> |
||||||
|
int(0) |
||||||
|
} |
||||||
|
bool(true) |
||||||
|
bool(true) |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
--TEST-- |
||||||
|
Bug #24908 (super-globals cannot be used in __destruct()) |
||||||
|
--INI-- |
||||||
|
variables_order=GPS |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
class test { |
||||||
|
function __construct() { |
||||||
|
if (count($_SERVER)) echo "O"; |
||||||
|
} |
||||||
|
function __destruct() { |
||||||
|
if (count($_SERVER)) echo "K\n"; |
||||||
|
} |
||||||
|
} |
||||||
|
function main() { |
||||||
|
$test = new test(); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
OK |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
--TEST-- |
||||||
|
Bug #55754 (Only variables should be passed by reference for ZEND_SEND_PREFER_REF params) |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
|
||||||
|
current($arr = array(0 => "a")); |
||||||
|
current(array(0 => "a")); |
||||||
|
current($arr); |
||||||
|
|
||||||
|
echo "DONE"; |
||||||
|
|
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
DONE |
||||||
Loading…
Reference in new issue