1--TEST-- 2Test that ReflectionMethod::setAccessible() has no effects 3--FILE-- 4<?php 5class A { 6 private function aPrivate($a) { print __METHOD__ . "\n"; } 7 private static function aPrivateStatic($a) { print __METHOD__ . "\n"; } 8 protected function aProtected($a) { print __METHOD__ . "\n"; } 9 protected static function aProtectedStatic($a) { print __METHOD__ . "\n"; } 10} 11 12$private = new ReflectionMethod('A', 'aPrivate'); 13$privateStatic = new ReflectionMethod('A', 'aPrivateStatic'); 14$protected = new ReflectionMethod('A', 'aProtected'); 15$protectedStatic = new ReflectionMethod('A', 'aProtectedStatic'); 16 17$private->invoke(new A, NULL); 18$private->invokeArgs(new A, array(NULL)); 19$privateStatic->invoke(NULL, NULL); 20$privateStatic->invokeArgs(NULL, array(NULL)); 21$protected->invoke(new A, NULL); 22$protected->invokeArgs(new A, array(NULL)); 23$protectedStatic->invoke(NULL, NULL); 24$protectedStatic->invokeArgs(NULL, array(NULL)); 25 26$private->setAccessible(FALSE); 27$privateStatic->setAccessible(FALSE); 28$protected->setAccessible(FALSE); 29$protectedStatic->setAccessible(FALSE); 30 31$private->invoke(new A, NULL); 32$private->invokeArgs(new A, array(NULL)); 33$privateStatic->invoke(NULL, NULL); 34$privateStatic->invokeArgs(NULL, array(NULL)); 35$protected->invoke(new A, NULL); 36$protected->invokeArgs(new A, array(NULL)); 37$protectedStatic->invoke(NULL, NULL); 38$protectedStatic->invokeArgs(NULL, array(NULL)); 39?> 40--EXPECT-- 41A::aPrivate 42A::aPrivate 43A::aPrivateStatic 44A::aPrivateStatic 45A::aProtected 46A::aProtected 47A::aProtectedStatic 48A::aProtectedStatic 49A::aPrivate 50A::aPrivate 51A::aPrivateStatic 52A::aPrivateStatic 53A::aProtected 54A::aProtected 55A::aProtectedStatic 56A::aProtectedStatic 57