--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-
- $tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
- if (!is_dir($tempdir)) {
- mkdir ($tempdir, 0777, true);
- }
-
- $userinput = "1\0"; // from post or get data
- $temp = $tempdir. "/test" . $userinput .".tmp";
-
- echo "\nimagegd2 TEST\n";
- try {
- imagegd2($image, $temp);
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- var_dump(file_exists($tempdir. "/test1"));
- var_dump(file_exists($tempdir. "/test1.tmp"));
+ var_dump(imagegd2($image, "./foo\0bar"));
+ ?>
---EXPECTF--
+?>
+--EXPECT--
- imagegd2 TEST
- imagegd2() expects parameter 2 to be a valid path, string given
- bool(false)
- bool(false)
+ Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
+ NULL
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-
- $tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
- if (!is_dir($tempdir)) {
- mkdir ($tempdir, 0777, true);
- }
-
- $userinput = "1\0"; // from post or get data
- $temp = $tempdir. "/test" . $userinput .".tmp";
-
- echo "\nimagegd TEST\n";
- try {
- imagegd($image, $temp);
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- var_dump(file_exists($tempdir. "/test1"));
- var_dump(file_exists($tempdir. "/test1.tmp"));
+ var_dump(imagegd($image, "./foo\0bar"));
?>
---EXPECTF--
+--EXPECT--
- imagegd TEST
- imagegd() expects parameter 2 to be a valid path, string given
- bool(false)
- bool(false)
+ Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
+ NULL