File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1573,8 +1573,10 @@ PHP_FUNCTION(populate_post_data)
1573
1573
1574
1574
if (!content_type && input_stream_zv ) {
1575
1575
zend_throw_error (NULL , "$content_type must be set if $input_stream is passed" );
1576
+ RETURN_THROWS ();
1576
1577
} else if (content_type && !input_stream_zv ) {
1577
1578
zend_throw_error (NULL , "$content_type must not be set if $input_stream is not passed" );
1579
+ RETURN_THROWS ();
1578
1580
}
1579
1581
1580
1582
php_stream * input_stream = NULL ;
@@ -1583,10 +1585,21 @@ PHP_FUNCTION(populate_post_data)
1583
1585
}
1584
1586
SG (rfc1867_input_stream ) = input_stream ;
1585
1587
1588
+ const char * content_type_c ;
1589
+ if (content_type ) {
1590
+ content_type_c = ZSTR_VAL (content_type );
1591
+ } else {
1592
+ content_type_c = SG (request_info ).content_type ;
1593
+ if (!content_type ) {
1594
+ zend_throw_error (NULL , "Request does not provide a content type" );
1595
+ RETURN_THROWS ();
1596
+ }
1597
+ }
1598
+
1586
1599
zval post , files ;
1587
1600
array_init (& post );
1588
1601
array_init (& files );
1589
- sapi_read_post_data_ex (content_type ? ZSTR_VAL ( content_type ) : SG ( request_info ). content_type );
1602
+ sapi_read_post_data_ex (content_type_c );
1590
1603
sapi_handle_post_ex (& post , & files );
1591
1604
RETURN_ARR (zend_new_pair (& post , & files ));
1592
1605
}
You can’t perform that action at this time.
0 commit comments