diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-06-12 12:47:06 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-06-12 12:48:03 +0200 |
commit | fc7b3cc7ca523d703a0270b79011ed4725ed942f (patch) | |
tree | ede940bc7c675008ab359afc6a9f32c5ec4a78c7 | |
parent | be73ae31324f7f3294a9467c0646dba4324c78ef (diff) | |
download | php-git-fc7b3cc7ca523d703a0270b79011ed4725ed942f.tar.gz |
Fix nullbyte tests
As of PHP 8.0.0, failing ZPP throws instead of issuing warnings, to
which we have to cater to.
-rw-r--r-- | ext/gd/tests/imagegd2_nullbyte_injection.phpt | 10 | ||||
-rw-r--r-- | ext/gd/tests/imagegd_nullbyte_injection.phpt | 9 | ||||
-rw-r--r-- | ext/gd/tests/imagexbm_nullbyte_injection.phpt | 11 |
3 files changed, 18 insertions, 12 deletions
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index 856acaefee..30394cc1a5 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 6bcc0ee2bc..f53d9b5dac 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 b485315064..a24aa3c007 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 |