<?php
class MySweetAssClass
{
private function my_private_method()
{
echo "show me on the doll where the bad language touched you";
}
}
$method = new ReflectionMethod('MySweetAssClass', 'my_private_method');
$method->setAccessible(true);
$class = MySweetAssClass;
echo $class->my_private_method();
#echo $method->invoke(new MySweetAssClass, 'my_private_method');
?>
Fatal error: Uncaught Error: Undefined constant "MySweetAssClass" in /in/8kTYA:12
Stack trace:
#0 {main}
thrown in /in/8kTYA on line 12
Process exited with code 255.
Warning: Use of undefined constant MySweetAssClass - assumed 'MySweetAssClass' (this will throw an Error in a future version of PHP) in /in/8kTYA on line 12
Fatal error: Uncaught Error: Call to a member function my_private_method() on string in /in/8kTYA:13
Stack trace:
#0 {main}
thrown in /in/8kTYA on line 13
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Use of undefined constant MySweetAssClass - assumed 'MySweetAssClass' in /in/8kTYA on line 12
Fatal error: Uncaught Error: Call to a member function my_private_method() on string in /in/8kTYA:13
Stack trace:
#0 {main}
thrown in /in/8kTYA on line 13
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Notice: Use of undefined constant MySweetAssClass - assumed 'MySweetAssClass' in /in/8kTYA on line 12
Fatal error: Call to a member function my_private_method() on string in /in/8kTYA on line 13
Process exited with code 255.
Notice: Use of undefined constant MySweetAssClass - assumed 'MySweetAssClass' in /in/8kTYA on line 12
Fatal error: Call to a member function my_private_method() on a non-object in /in/8kTYA on line 13
Process exited with code 255.
Fatal error: Call to undefined method ReflectionMethod::setAccessible() in /in/8kTYA on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/8kTYA on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/8kTYA on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/8kTYA on line 4
Process exited with code 255.