Skip to content

Commit 53ac278

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 295a177 commit 53ac278

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
@@ -336,7 +336,7 @@ PHP_FUNCTION(request_parse_body)
336336

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

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)