Created
February 14, 2020 08:55
-
-
Save AllenJB/fd2fdea2ff3cbab7cbf74463f0650994 to your computer and use it in GitHub Desktop.
PHP Intentional Error Tests
This file contains hidden or 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
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