belliash
55acf8111f
All checks were successful
The build was successful.
In most (all?) modern OOP languages class members visibility is assumed to be private and programmer has to consciously set it to public or protected. PHP has the different approach what can cause a security flaws in written scripts. AerScript will not follow this way, as it seems to be conceptually broken.
34 lines
676 B
Plaintext
34 lines
676 B
Plaintext
class ExceptionHandler {
|
|
|
|
public static void printException(Exception $e) {
|
|
print('Uncaught ' + get_class($e) + ', code: ' + $e->getCode() + "\nMessage: " + htmlentities($e->getMessage()) + "\n");
|
|
}
|
|
|
|
public static void handleException(Exception $e) {
|
|
self::printException($e);
|
|
}
|
|
|
|
}
|
|
|
|
class NewException extends Exception {
|
|
}
|
|
|
|
class Program {
|
|
|
|
public void main() {
|
|
callback $handler = void(Exception $e) {
|
|
ExceptionHandler::handleException($e);
|
|
};
|
|
set_exception_handler($handler);
|
|
try {
|
|
throw new NewException("Catch me once", 1);
|
|
} catch(Exception $e) {
|
|
ExceptionHandler::handleException($e);
|
|
}
|
|
throw new Exception("Catch me twice", 2);
|
|
}
|
|
|
|
}
|
|
|
|
|