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);
}
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
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);
}
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
--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'); }
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);
}
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
--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'); }
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);
}
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
--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'); }
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);
}
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
--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'); }
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);
}
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
--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'); }
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);
}
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