1--TEST-- 2Bug #32290 (calling call_user_func_array() ends in infinite loop within child class) 3--INI-- 4error_reporting=8191 5--FILE-- 6<?php 7 8class TestA 9{ 10 public function doSomething($i) 11 { 12 echo __METHOD__ . "($i)\n"; 13 return --$i; 14 } 15 16 public function doSomethingThis($i) 17 { 18 echo __METHOD__ . "($i)\n"; 19 return --$i; 20 } 21 22 public function doSomethingParent($i) 23 { 24 echo __METHOD__ . "($i)\n"; 25 return --$i; 26 } 27 28 public function doSomethingParentThis($i) 29 { 30 echo __METHOD__ . "($i)\n"; 31 return --$i; 32 } 33 34 public static function doSomethingStatic($i) 35 { 36 echo __METHOD__ . "($i)\n"; 37 return --$i; 38 } 39} 40 41class TestB extends TestA 42{ 43 public function doSomething($i) 44 { 45 echo __METHOD__ . "($i)\n"; 46 $i++; 47 if ($i >= 5) return 5; 48 return call_user_func_array(array("TestA", "doSomething"), array($i)); 49 } 50 51 public function doSomethingThis($i) 52 { 53 echo __METHOD__ . "($i)\n"; 54 $i++; 55 if ($i >= 5) return 5; 56 return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i)); 57 } 58 59 public function doSomethingParent($i) 60 { 61 echo __METHOD__ . "($i)\n"; 62 $i++; 63 if ($i >= 5) return 5; 64 return call_user_func_array(array("parent", "doSomethingParent"), array($i)); 65 } 66 67 public function doSomethingParentThis($i) 68 { 69 echo __METHOD__ . "($i)\n"; 70 $i++; 71 if ($i >= 5) return 5; 72 return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i)); 73 } 74 75 public static function doSomethingStatic($i) 76 { 77 echo __METHOD__ . "($i)\n"; 78 $i++; 79 if ($i >= 5) return 5; 80 return call_user_func_array(array("TestA", "doSomethingStatic"), array($i)); 81 } 82} 83 84$x = new TestB(); 85echo "===A===\n"; 86var_dump($x->doSomething(1)); 87echo "\n===B===\n"; 88var_dump($x->doSomethingThis(1)); 89echo "\n===C===\n"; 90var_dump($x->doSomethingParent(1)); 91echo "\n===D===\n"; 92var_dump($x->doSomethingParentThis(1)); 93echo "\n===E===\n"; 94var_dump($x->doSomethingStatic(1)); 95 96?> 97===DONE=== 98<?php exit(0); ?> 99--EXPECT-- 100===A=== 101TestB::doSomething(1) 102TestA::doSomething(2) 103int(1) 104 105===B=== 106TestB::doSomethingThis(1) 107TestA::doSomethingThis(2) 108int(1) 109 110===C=== 111TestB::doSomethingParent(1) 112TestA::doSomethingParent(2) 113int(1) 114 115===D=== 116TestB::doSomethingParentThis(1) 117TestA::doSomethingParentThis(2) 118int(1) 119 120===E=== 121TestB::doSomethingStatic(1) 122TestA::doSomethingStatic(2) 123int(1) 124===DONE=== 125