Created
November 29, 2014 10:22
-
-
Save cystbear/07b7ef3f31f45def7da4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ErrorPreventer | |
{ | |
private static $squatter; | |
public static function init() | |
{ | |
static::$squatter = new \SplFixedArray(100000); | |
register_shutdown_function(array(__CLASS__, 'helpMe')); | |
if (php_sapi_name()){}; | |
} | |
public static function helpMe() | |
{ | |
print memory_get_usage(); | |
print "\n"; | |
static::$squatter = null; | |
print memory_get_usage(); | |
ob_end_clean(); | |
$overMemoryVar = 'I am over memory limit var'; | |
var_dump(error_get_last()); | |
} | |
} | |
echo '<pre/>'; | |
ErrorPreventer::init(); | |
throw new \Exception('fuck'); | |
echo 'hooray'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment