Skip to content

Instantly share code, notes, and snippets.

@Bachsau
Last active August 27, 2020 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bachsau/539736d98d312f0aed68c5c447f7d822 to your computer and use it in GitHub Desktop.
Save Bachsau/539736d98d312f0aed68c5c447f7d822 to your computer and use it in GitHub Desktop.
Stop PHP’s dangerous name handling
<?php
// Stop PHP’s dangerous name handling
function undefined_name_error($errno, $errstr, $errfile='', $errline=0, $errcontext=NULL) {
if (stripos($errstr, 'Undefined') !== false) {
error_log("PHP Fatal error: $errstr in $errfile on line $errline");
exit(255);
}
else {
return false;
}
}
set_error_handler('undefined_name_error', E_NOTICE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment