If the string is too short, we should treat this the same way as
an unrecognized image type. This function should be usable to
determine whether something is a valid image without doing any
checks beforehand.
}
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));
--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