diff options
-rw-r--r-- | ext/gd/gd.c | 5 | ||||
-rw-r--r-- | ext/gd/tests/createfromstring.phpt | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 88d04824ea..7a50fb423e 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1483,8 +1483,9 @@ PHP_FUNCTION(imagecreatefromstring) } if (ZSTR_LEN(data) < sizeof(sig)) { - zend_argument_value_error(1, "cannot be empty"); - RETURN_THROWS(); + /* Handle this the same way as an unknown image type. */ + php_error_docref(NULL, E_WARNING, "Data is not in a recognized format"); + RETURN_FALSE; } memcpy(sig, ZSTR_VAL(data), sizeof(sig)); diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt index 6586d17c31..f3e40b26a9 100644 --- a/ext/gd/tests/createfromstring.phpt +++ b/ext/gd/tests/createfromstring.phpt @@ -62,6 +62,7 @@ $im = imagecreatefromstring(' asdf jklp foo'); --EXPECTF-- createfromstring truecolor png: ok createfromstring palette png: ok -imagecreatefromstring(): Argument #1 ($data) cannot be empty -Warning: imagecreatefromstring(): Data is not in a recognized format in %screatefromstring.php on line %d +Warning: imagecreatefromstring(): Data is not in a recognized format in %s on line %d + +Warning: imagecreatefromstring(): Data is not in a recognized format in %s on line %d |