File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1894,7 +1894,7 @@ PHP_FUNCTION(pg_fetch_result)
18941894 Z_PARAM_OBJECT_OF_CLASS (result , pgsql_result_ce )
18951895 Z_PARAM_STR_OR_LONG (field_name , field_offset )
18961896 ZEND_PARSE_PARAMETERS_END ();
1897- } else {
1897+ } else if ( ZEND_NUM_ARGS () == 3 ) {
18981898 ZEND_PARSE_PARAMETERS_START (3 , 3 )
18991899 Z_PARAM_OBJECT_OF_CLASS (result , pgsql_result_ce )
19001900 if (zend_string_equals_literal (EG (current_execute_data )-> func -> common .function_name , "pg_result" )) {
@@ -1904,6 +1904,9 @@ PHP_FUNCTION(pg_fetch_result)
19041904 }
19051905 Z_PARAM_STR_OR_LONG (field_name , field_offset )
19061906 ZEND_PARSE_PARAMETERS_END ();
1907+ } else {
1908+ zend_wrong_parameters_count_error (2 , 3 );
1909+ RETURN_THROWS ();
19071910 }
19081911
19091912 pg_result = Z_PGSQL_RESULT_P (result );
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-17158 (pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument)
3+ --EXTENSIONS--
4+ pgsql
5+ --FILE--
6+ <?php
7+
8+ try {
9+ pg_fetch_result (null );
10+ } catch (ArgumentCountError $ e ) {
11+ echo $ e ->getMessage (), "\n" ;
12+ }
13+
14+ ?>
15+ --EXPECT--
16+ pg_fetch_result() expects at least 2 arguments, 1 given
You can’t perform that action at this time.
0 commit comments