com php-src: Fix nullbyte tests: ext/gd/tests/imagegd2_null byte_injection.phpt ext/gd/tests/imagegd_nullbyte_inj ection.phpt
ext/gd/tests/imagexbm_nullbyte_injection. phpt

From: Date: Wed, 12 Jun 2019 10:48:03 +0000
Subject: com php-src: Fix nullbyte tests: ext/gd/tests/imagegd2_null byte_injection.phpt ext/gd/tests/imagegd_nullbyte_inj ection.phpt
ext/gd/tests/imagexbm_nullbyte_injection. phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106711@lists.php.net to get a copy of this message
Commit: fc7b3cc7ca523d703a0270b79011ed4725ed942f Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 12 Jun 2019 12:47:06 +0200 Parents: be73ae31324f7f3294a9467c0646dba4324c78ef Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc7b3cc7ca523d703a0270b79011ed4725ed942f Log: Fix nullbyte tests As of PHP 8.0.0, failing ZPP throws instead of issuing warnings, to which we have to cater to. Changed paths: M ext/gd/tests/imagegd2_nullbyte_injection.phpt M ext/gd/tests/imagegd_nullbyte_injection.phpt M ext/gd/tests/imagexbm_nullbyte_injection.phpt Diff: diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index 856acae..30394cc 100644 --- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd2_nullbyte_injection..phpt @@ -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 diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt index 6bcc0ee..f53d9b5 100644 --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@ -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 diff --git a/ext/gd/tests/imagexbm_nullbyte_injection.phpt b/ext/gd/tests/imagexbm_nullbyte_injection.phpt index b485315..a24aa3c 100644 --- a/ext/gd/tests/imagexbm_nullbyte_injection.phpt +++ b/ext/gd/tests/imagexbm_nullbyte_injection.phpt @@ -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

« previous php.cvs (#106711) next »