com php-src: fix flaky gd tests: ext/gd/tests/imagegd2_null byte_injection.phpt ext/gd/tests/imagegd_nullbyte_inj ection.phpt
ext/gd/tests/imagegif_nullbyte_injection. phpt ext/gd/tests/imagejpeg_nullbyte_injection.phpt e xt/gd/tests/imagepng_nullbyte_injection.phpt
ext/gd/tes ts/imagewbmp_nullbyte_injection.phpt ext/gd/tests/image webp_nullbyte_injection.phpt
| From: | Joe Watkins | Date: | Wed, 12 Jun 2019 05:52:28 +0000 |
| Subject: | com php-src: fix flaky gd tests: ext/gd/tests/imagegd2_null byte_injection.phpt ext/gd/tests/imagegd_nullbyte_inj ection.phpt ext/gd/tests/imagegif_nullbyte_injection. phpt ext/gd/tests/imagejpeg_nullbyte_injection.phpt e xt/gd/tests/imagepng_nullbyte_injection.phpt ext/gd/tes ts/imagewbmp_nullbyte_injection.phpt ext/gd/tests/image webp_nullbyte_injection.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106688@lists.php.net to get a copy of this message | ||
Commit: 2dfa49531170e55d9a9bf4933bc3d60ee05c157f
Author: Joe Watkins <krakjoe@php.net> Wed, 12 Jun 2019 07:52:28 +0200
Parents: 8ab3e7bc0c3b7153c4d3526fb32b3552e0393141
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2dfa49531170e55d9a9bf4933bc3d60ee05c157f
Log:
fix flaky gd tests
Changed paths:
M ext/gd/tests/imagegd2_nullbyte_injection.phpt
M ext/gd/tests/imagegd_nullbyte_injection.phpt
M ext/gd/tests/imagegif_nullbyte_injection.phpt
M ext/gd/tests/imagejpeg_nullbyte_injection.phpt
M ext/gd/tests/imagepng_nullbyte_injection.phpt
M ext/gd/tests/imagewbmp_nullbyte_injection.phpt
M ext/gd/tests/imagewebp_nullbyte_injection.phpt
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index 2370d50..4307704 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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -25,7 +24,6 @@ echo "\nimagegd2 TEST\n"; imagegd2($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } --EXPECTF-- imagegd2 TEST diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt index 25e54fe..f904bbf 100644 --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@ -5,16 +5,15 @@ Testing null byte injection in imagegd 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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -25,7 +24,7 @@ echo "\nimagegd TEST\n"; imagegd($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagegd TEST diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt index 26cddf3..0f3e5b8 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === print 'skip gif support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagegif TEST\n"; imagegif($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagegif TEST diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt index 3d49584..38eadab 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) { print 'skip jpeg support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagejpeg TEST\n"; imagejpeg($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagejpeg TEST diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt index 56ba646..bc9c340 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['PNG Support']) || $support['PNG Support'] === false) { print 'skip png support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagepng TEST\n"; imagepng($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagepng TEST diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt index 1d3e460..466584f9 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) { print 'skip wbmp support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagewbmp TEST\n"; imagewbmp($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagewbmp TEST diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt index 1808e8f..9d46a21 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['WebP Support']) || $support['WebP Support'] === false) { print 'skip webp support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,6 @@ echo "\nimagewebp TEST\n"; imagewebp($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } ?> --EXPECTF-- imagewebp TEST
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index 2370d50..4307704 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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -25,7 +24,6 @@ echo "\nimagegd2 TEST\n"; imagegd2($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } --EXPECTF-- imagegd2 TEST diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt index 25e54fe..f904bbf 100644 --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@ -5,16 +5,15 @@ Testing null byte injection in imagegd 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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -25,7 +24,7 @@ echo "\nimagegd TEST\n"; imagegd($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagegd TEST diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt index 26cddf3..0f3e5b8 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === print 'skip gif support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagegif TEST\n"; imagegif($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagegif TEST diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt index 3d49584..38eadab 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) { print 'skip jpeg support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagejpeg TEST\n"; imagejpeg($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagejpeg TEST diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt index 56ba646..bc9c340 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['PNG Support']) || $support['PNG Support'] === false) { print 'skip png support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagepng TEST\n"; imagepng($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagepng TEST diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt index 1d3e460..466584f9 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) { print 'skip wbmp support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,7 @@ echo "\nimagewbmp TEST\n"; imagewbmp($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } +?> --EXPECTF-- imagewbmp TEST diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt index 1808e8f..9d46a21 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-- <?php if(!extension_loaded('gd')){ die('skip gd extension not available'); } @@ -12,13 +8,16 @@ if (!isset($support['WebP Support']) || $support['WebP Support'] === false) { print 'skip webp support not available'; } ?> +--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-- <?php $image = imagecreate(1,1);// 1px image - -$tempdir = sys_get_temp_dir(). '/php-gdtest'; -if (!file_exists($tempdir) && !is_dir($tempdir)) { +$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); +if (!is_dir($tempdir)) { mkdir ($tempdir, 0777, true); } @@ -29,7 +28,6 @@ echo "\nimagewebp TEST\n"; imagewebp($image, $temp); var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); -foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } ?> --EXPECTF-- imagewebp TEST