Skip to content

Commit c6e1e30

Browse files
authored
ext/standard: Throw a RequestParseBodyException instead of InvalidArgumentException (php#15468)
Especially as this exception is thrown when there isn't an issue with an argument
1 parent 3813ad1 commit c6e1e30

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

ext/standard/http.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "url.h"
2020
#include "SAPI.h"
2121
#include "zend_exceptions.h"
22-
#include "ext/spl/spl_exceptions.h"
2322
#include "basic_functions.h"
2423

2524
static void php_url_encode_scalar(zval *scalar, smart_str *form_str,
@@ -338,7 +337,7 @@ PHP_FUNCTION(request_parse_body)
338337

339338
sapi_read_post_data();
340339
if (!SG(request_info).post_entry) {
341-
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);
342341
goto exit;
343342
}
344343

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)