1--TEST-- 2Bug #29210 (Function is_callable does not support private and protected methods) 3--FILE-- 4<?php 5class test_class { 6 private function test_func1() { 7 echo "test_func1\n"; 8 } 9 protected function test_func2() { 10 echo "test_func2\n"; 11 } 12 static private function test_func3() { 13 echo "test_func3\n"; 14 } 15 static protected function test_func4() { 16 echo "test_func4\n"; 17 } 18 function test() { 19 if (is_callable(array($this,'test_func1'))) { 20 $this->test_func1(); 21 } else { 22 echo "test_func1 isn't callable from inside\n"; 23 } 24 if (is_callable(array($this,'test_func2'))) { 25 $this->test_func2(); 26 } else { 27 echo "test_func2 isn't callable from inside\n"; 28 } 29 if (is_callable(array('test_class','test_func3'))) { 30 test_class::test_func3(); 31 } else { 32 echo "test_func3 isn't callable from inside\n"; 33 } 34 if (is_callable(array('test_class','test_func4'))) { 35 test_class::test_func4(); 36 } else { 37 echo "test_func4 isn't callable from inside\n"; 38 } 39 } 40} 41 42class foo extends test_class { 43 function test() { 44 if (is_callable(array($this,'test_func1'))) { 45 $this->test_func1(); 46 } else { 47 echo "test_func1 isn't callable from child\n"; 48 } 49 if (is_callable(array($this,'test_func2'))) { 50 $this->test_func2(); 51 } else { 52 echo "test_func2 isn't callable from child\n"; 53 } 54 if (is_callable(array('test_class','test_func3'))) { 55 test_class::test_func3(); 56 } else { 57 echo "test_func3 isn't callable from child\n"; 58 } 59 if (is_callable(array('test_class','test_func4'))) { 60 test_class::test_func4(); 61 } else { 62 echo "test_func4 isn't callable from child\n"; 63 } 64 } 65} 66 67$object = new test_class; 68$object->test(); 69if (is_callable(array($object,'test_func1'))) { 70 $object->test_func1(); 71} else { 72 echo "test_func1 isn't callable from outside\n"; 73} 74if (is_callable(array($object,'test_func2'))) { 75 $object->test_func2(); 76} else { 77 echo "test_func2 isn't callable from outside\n"; 78} 79if (is_callable(array('test_class','test_func3'))) { 80 test_class::test_func3(); 81} else { 82 echo "test_func3 isn't callable from outside\n"; 83} 84if (is_callable(array('test_class','test_func4'))) { 85 test_class::test_func4(); 86} else { 87 echo "test_func4 isn't callable from outside\n"; 88} 89$object = new foo(); 90$object->test(); 91?> 92--EXPECT-- 93test_func1 94test_func2 95test_func3 96test_func4 97test_func1 isn't callable from outside 98test_func2 isn't callable from outside 99test_func3 isn't callable from outside 100test_func4 isn't callable from outside 101test_func1 isn't callable from child 102test_func2 103test_func3 isn't callable from child 104test_func4 105