Annotation of embedaddon/php/tests/classes/bug27504.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #27504 (call_user_func_array allows calling of private/protected methods)
! 3: --FILE--
! 4: <?php
! 5: class foo {
! 6: function __construct () {
! 7: $this->bar('1');
! 8: }
! 9: private function bar ( $param ) {
! 10: echo 'Called function foo:bar('.$param.')'."\n";
! 11: }
! 12: }
! 13:
! 14: $foo = new foo();
! 15:
! 16: call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
! 17:
! 18: $foo->bar('3');
! 19: ?>
! 20: --EXPECTF--
! 21: Called function foo:bar(1)
! 22:
! 23: Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar() in %s on line %d
! 24:
! 25: Fatal error: Call to private method foo::bar() from context '' in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>