- 添加了动态调用时的作用域切换代码生成 - 修复了 MethodCall 中的动态调用检测逻辑,区分魔法方法调用 - 为类方法定义添加了 hasDynamicCall 属性标识 - 实现了类继承链中私有方法重写的错误检查 - 添加了多个测试用例验证字符串连接性能和动态调用行为pull/1/head
parent
08cbfa1d71
commit
28de6c86a4
6 changed files with 126 additions and 3 deletions
@ -0,0 +1,32 @@ |
||||
--TEST-- |
||||
Bug #40809 (Poor performance of ".=") |
||||
--FILE-- |
||||
<?php |
||||
|
||||
$num_increments = 100; |
||||
$num_repeats = 1000; |
||||
$increment = 50; |
||||
|
||||
/* Create some more holes to give the memory allocator something to |
||||
* work with. */ |
||||
$num = 5000; |
||||
$a = Array(); |
||||
for ($i=0; $i<$num; $i++) { |
||||
$a[$i] = Array(1); |
||||
} |
||||
for ($i=0; $i<$num; $i++) { |
||||
$b[$i] = $a[$i][0]; |
||||
} |
||||
unset($a); |
||||
|
||||
for ($i=0;$i<$num_repeats;$i++) { |
||||
$evil = ""; |
||||
for ($j=0;$j<$num_increments;$j++) { |
||||
$evil .= str_repeat("a", $increment); |
||||
} |
||||
unset($evil); |
||||
} |
||||
echo "ok\n"; |
||||
?> |
||||
--EXPECT-- |
||||
ok |
||||
@ -0,0 +1,21 @@ |
||||
--TEST-- |
||||
Bug #44069 (Huge memory usage with concatenation using . instead of .=) |
||||
--FILE-- |
||||
<?php |
||||
$array = array(); |
||||
$newstring = ""; |
||||
$string = str_repeat('This is a teststring.', 50); |
||||
for($i = 1; $i <= 2000; $i++) |
||||
{ |
||||
// $newstring .= $string; //This uses an expected amount of mem. |
||||
$newstring = $newstring . $string; //This uses very much mem. |
||||
|
||||
for($j = 1; $j <= 10; $j++) |
||||
{ |
||||
$array[] = 'test'; |
||||
} |
||||
} |
||||
echo "ok\n"; |
||||
?> |
||||
--EXPECT-- |
||||
ok |
||||
@ -0,0 +1,42 @@ |
||||
--TEST-- |
||||
Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method()) |
||||
--FILE-- |
||||
<?php |
||||
class A |
||||
{ |
||||
protected function Test() |
||||
{ |
||||
echo 'Hello from '.get_class($this)."\n"; |
||||
} |
||||
|
||||
public function call($method, $args = array()) |
||||
{ |
||||
$this->Test(); |
||||
$this->$method(); |
||||
call_user_func(array($this, $method)); |
||||
} |
||||
} |
||||
|
||||
class B extends A |
||||
{ |
||||
protected function Test() |
||||
{ |
||||
echo 'Overridden hello from '.get_class($this)."\n"; |
||||
} |
||||
} |
||||
|
||||
function main() { |
||||
$a = new A; |
||||
$b = new B; |
||||
|
||||
$a->call('Test'); |
||||
$b->call('Test'); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
Hello from A |
||||
Hello from A |
||||
Hello from A |
||||
Overridden hello from B |
||||
Overridden hello from B |
||||
Overridden hello from B |
||||
Loading…
Reference in new issue