summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/gd/tests/imagegd2_nullbyte_injection.phpt8
-rw-r--r--ext/gd/tests/imagegd_nullbyte_injection.phpt9
-rw-r--r--ext/gd/tests/imagegif_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagejpeg_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagepng_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagewbmp_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagewebp_nullbyte_injection.phpt14
7 files changed, 41 insertions, 50 deletions
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--
<?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 25e54fe36c..f904bbf174 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 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--
<?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 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--
<?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 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--
<?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 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--
<?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 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--
<?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