Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP Intentional Error Tests
public function fatalMemory() : void
{
$a = '';
while (true) {
$a .= str_repeat("Hello", 1024 * 1024);
}
}
public function timeout() : void
{
$tsLimit = time() + 120;
while (time() < $tsLimit) {
// Do nothing;
$v = file_get_contents(PROJECT_ROOT . "composer.json");
}
print "Timeout!\n";
}
public function timeoutIgnoreAbort() : void
{
ignore_user_abort(true);
set_time_limit(1);
$tsLimit = time() + 5;
while (time() < $tsLimit) {
// Do nothing;
$v = file_get_contents(PROJECT_ROOT . "composer.json");
}
print "Timeout!\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.