From: Joe Watkins Date: Wed, 12 Jun 2019 05:52:28 +0000 (+0200) Subject: fix flaky gd tests X-Git-Tag: php-7.4.0alpha1~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2dfa49531170e55d9a9bf4933bc3d60ee05c157f;p=php fix flaky gd tests --- diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index 2370d5036e..4307704ee2 100644 --- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt @@ -5,16 +5,15 @@ Testing null byte injection in imagegd2 if(!extension_loaded('gd')){ die('skip gd extension not available'); } ?> --CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } rmdir($tempdir); --FILE-- --CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } rmdir($tempdir); --FILE-- --EXPECTF-- imagegd TEST diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt index 26cddf3400..0f3e5b8bad 100644 --- a/ext/gd/tests/imagegif_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegif_nullbyte_injection.phpt @@ -1,9 +1,5 @@ --TEST-- Testing null byte injection in imagegif ---CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } -rmdir($tempdir); --SKIPIF-- +--CLEAN-- +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +rmdir($tempdir); --FILE-- --EXPECTF-- imagegif TEST diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt index 3d49584791..38eadab4ae 100644 --- a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt +++ b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt @@ -1,9 +1,5 @@ --TEST-- Testing null byte injection in imagejpeg ---CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } -rmdir($tempdir); --SKIPIF-- +--CLEAN-- +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +rmdir($tempdir); --FILE-- --EXPECTF-- imagejpeg TEST diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt index 56ba6462e4..bc9c340397 100644 --- a/ext/gd/tests/imagepng_nullbyte_injection.phpt +++ b/ext/gd/tests/imagepng_nullbyte_injection.phpt @@ -1,9 +1,5 @@ --TEST-- Testing null byte injection in imagepng ---CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } -rmdir($tempdir); --SKIPIF-- +--CLEAN-- +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +rmdir($tempdir); --FILE-- --EXPECTF-- imagepng TEST diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt index 1d3e460444..466584f968 100644 --- a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt +++ b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt @@ -1,9 +1,5 @@ --TEST-- Testing null byte injection in imagewbmp ---CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } -rmdir($tempdir); --SKIPIF-- +--CLEAN-- +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +rmdir($tempdir); --FILE-- --EXPECTF-- imagewbmp TEST diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt index 1808e8fb79..9d46a21140 100644 --- a/ext/gd/tests/imagewebp_nullbyte_injection.phpt +++ b/ext/gd/tests/imagewebp_nullbyte_injection.phpt @@ -1,9 +1,5 @@ --TEST-- Testing null byte injection in imagewebp ---CLEAN-- -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } -rmdir($tempdir); --SKIPIF-- +--CLEAN-- +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +rmdir($tempdir); --FILE-- --EXPECTF-- imagewebp TEST