Skip to content

Instantly share code, notes, and snippets.

@cystbear
Created November 29, 2014 10:22
Show Gist options
  • Save cystbear/07b7ef3f31f45def7da4 to your computer and use it in GitHub Desktop.
Save cystbear/07b7ef3f31f45def7da4 to your computer and use it in GitHub Desktop.
<?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