]> granicus.if.org Git - php/commitdiff
Fix nullbyte tests
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 12 Jun 2019 10:47:06 +0000 (12:47 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 12 Jun 2019 10:48:03 +0000 (12:48 +0200)
As of PHP 8.0.0, failing ZPP throws instead of issuing warnings, to
which we have to cater to.

ext/gd/tests/imagegd2_nullbyte_injection.phpt
ext/gd/tests/imagegd_nullbyte_injection.phpt
ext/gd/tests/imagexbm_nullbyte_injection.phpt

index 856acaefeea899902578d6dba43c9bf12a052a54..30394cc1a5eeb65dcb65911f6b0dc97ebefab70c 100644 (file)
@@ -7,9 +7,11 @@ Testing null byte injection in imagegd2
 --FILE--
 <?php
 $image = imagecreate(1,1);// 1px image
-var_dump(imagegd2($image, "./foo\0bar"));
-?>
+try {
+    imagegd($image, "./foo\0bar");
+} catch (TypeError $e) {
+    echo $e->getMessage(), "\n";
+}
 ?>
 --EXPECT--
-Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+imagegd() expects parameter 2 to be a valid path, string given
index 6bcc0ee2bce12ce579f05ec23a6ccd0f14e36b7b..f53d9b5dac9d7f12a347324a6fb7124e47d30649 100644 (file)
@@ -7,8 +7,11 @@ Testing null byte injection in imagegd
 --FILE--
 <?php
 $image = imagecreate(1,1);// 1px image
-var_dump(imagegd($image, "./foo\0bar"));
+try {
+    imagegd($image, "./foo\0bar");
+} catch (TypeError $e) {
+    echo $e->getMessage(), "\n";
+}
 ?>
 --EXPECT--
-Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+imagegd() expects parameter 2 to be a valid path, string given
index b4853150648b64ffdea05d0be3cc76b79dd88ae2..a24aa3c0079c8e65eac3d8e0cdf35bbfc04d8cdc 100644 (file)
@@ -7,10 +7,11 @@ if(!extension_loaded('gd')) die('skip gd extension not available');
 --FILE--
 <?php
 $image = imagecreate(1,1);// 1px image
-var_dump(imagexbm($image, "./foo\0bar"));
+try {
+    imagexbm($image, "./foo\0bar");
+} catch (TypeError $e) {
+    echo $e->getMessage(), "\n";
+}
 ?>
-===DONE===
 --EXPECTF--
-Warning: imagexbm() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
-===DONE===
+imagexbm() expects parameter 2 to be a valid path, string given