<?php
// ClassA.php
class A {
public function __construct(){print "Init";}
public function bye(){print "Hey :)";}
}
//ScriptAClassAction.php
require 'ClassA.php';
$class = new A();
$reflection = new ReflectionClass($class);
if (!empty($reflection) && $reflection->hasMethod('hello')){
if($reflection->hasMethod('init')) $class->init($request, $response); //Prints 'Init called'
if($reflection->hasMethod('preDispatch')) $class->preDispatch(); // 'Predispatch called'
$class->hello();
if($reflection->hasMethod('postDispatch')) $class->postDispatch(); // 'post dispatch called'..
} else {
if (!$reflection) // I know this might not be the best check but..
print "Not a valid class supplied";
if (false == $reflection->hasMethod('hello')) // True trigger
print "Supplied class does not have any manners and does not greet you :D";
// This is the expected output and it should be the only output
}
Warning: require(): open_basedir restriction in effect. File(ClassA.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Dgga5 on line 11
Warning: require(ClassA.php): Failed to open stream: Operation not permitted in /in/Dgga5 on line 11
Fatal error: Uncaught Error: Failed opening required 'ClassA.php' (include_path='.:') in /in/Dgga5:11
Stack trace:
#0 {main}
thrown in /in/Dgga5 on line 11
Process exited with code 255.
Output for 8.0.13
Warning: require(ClassA.php): Failed to open stream: No such file or directory in /in/Dgga5 on line 11
Fatal error: Uncaught Error: Failed opening required 'ClassA.php' (include_path='.:') in /in/Dgga5:11
Stack trace:
#0 {main}
thrown in /in/Dgga5 on line 11
Process exited with code 255.
Warning: require(ClassA.php): failed to open stream: No such file or directory in /in/Dgga5 on line 11
Fatal error: require(): Failed opening required 'ClassA.php' (include_path='.:') in /in/Dgga5 on line 11
Process exited with code 255.
Warning: require(): open_basedir restriction in effect. File(ClassA.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Dgga5 on line 11
Warning: require(ClassA.php): failed to open stream: Operation not permitted in /in/Dgga5 on line 11
Fatal error: require(): Failed opening required 'ClassA.php' (include_path='.:') in /in/Dgga5 on line 11
Process exited with code 255.
Output for 7.1.20
Warning: require(): open_basedir restriction in effect. File(ClassA.php) is not within the allowed path(s): (/tmp:/in) in /in/Dgga5 on line 11
Warning: require(ClassA.php): failed to open stream: Operation not permitted in /in/Dgga5 on line 11
Fatal error: require(): Failed opening required 'ClassA.php' (include_path='.:') in /in/Dgga5 on line 11
Process exited with code 255.
Warning: require(ClassA.php): failed to open stream: No such file or directory in /in/EmSNu on line 11
Fatal error: require(): Failed opening required 'ClassA.php' (include_path='.:') in /in/EmSNu on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: main(ClassA.php): failed to open stream: No such file or directory in /in/EmSNu on line 11
Fatal error: main(): Failed opening required 'ClassA.php' (include_path='.:') in /in/EmSNu 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/EmSNu on line 5
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/EmSNu on line 5
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/EmSNu on line 5
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/Dgga5 on line 5
Process exited with code 255.