xref: /PHP-5.5/tests/classes/bug27504.phpt (revision 9411b268)
1--TEST--
2Bug #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--
21Called function foo:bar(1)
22
23Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar() in %s on line %d
24
25Fatal error: Call to private method foo::bar() from context '' in %s on line %d
26