From fc7b3cc7ca523d703a0270b79011ed4725ed942f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 12 Jun 2019 12:47:06 +0200 Subject: [PATCH] Fix nullbyte tests 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 | 10 ++++++---- ext/gd/tests/imagegd_nullbyte_injection.phpt | 9 ++++++--- 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-- +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-- 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-- 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 -- 2.50.1