Skip to content

Commit 48febb7

Browse files
committed
ext/standard: request_parse_body - change invalid content-type header exception to RequestParseBodyException
Currently, `request_parse_body` function throws an `InvalidArgumentException` exception if the request `Content-Type` header is invalid or of an unknown type such as `application/json`. To make this consistent with other exception conditions, this changes the exception type from `InvalidArgumentException` to `RequestParseBodyException`.
1 parent ffa3f4f commit 48febb7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/standard/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ PHP_FUNCTION(request_parse_body)
337337

338338
sapi_read_post_data();
339339
if (!SG(request_info).post_entry) {
340-
zend_throw_error(spl_ce_InvalidArgumentException, "Content-Type \"%s\" is not supported", SG(request_info).content_type);
340+
zend_throw_error(zend_ce_request_parse_body_exception, "Content-Type \"%s\" is not supported", SG(request_info).content_type);
341341
goto exit;
342342
}
343343

ext/standard/tests/http/request_parse_body/unsupported_content_type.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var_dump($_POST, $_FILES);
2020

2121
?>
2222
--EXPECT--
23-
InvalidArgumentException: Content-Type "application/json" is not supported
23+
RequestParseBodyException: Content-Type "application/json" is not supported
2424
array(0) {
2525
}
2626
array(0) {

0 commit comments

Comments
 (0)