mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
Closes GH-17161.
This commit is contained in:
parent
3490ac0cb3
commit
388f63c310
3 changed files with 24 additions and 1 deletions
4
NEWS
4
NEWS
|
@ -21,6 +21,10 @@ PHP NEWS
|
||||||
- Opcache:
|
- Opcache:
|
||||||
. opcache_get_configuration() properly reports jit_prof_threshold. (cmb)
|
. opcache_get_configuration() properly reports jit_prof_threshold. (cmb)
|
||||||
|
|
||||||
|
- PgSql:
|
||||||
|
. Fixed bug GH-17158 (pg_fetch_result Shows Incorrect ArgumentCountError
|
||||||
|
Message when Called With 1 Argument). (nielsdos)
|
||||||
|
|
||||||
- SimpleXML:
|
- SimpleXML:
|
||||||
. Fixed bug GH-17040 (SimpleXML's unset can break DOM objects). (nielsdos)
|
. Fixed bug GH-17040 (SimpleXML's unset can break DOM objects). (nielsdos)
|
||||||
|
|
||||||
|
|
|
@ -1710,7 +1710,7 @@ PHP_FUNCTION(pg_fetch_result)
|
||||||
Z_PARAM_OBJECT_OF_CLASS(result, pgsql_result_ce)
|
Z_PARAM_OBJECT_OF_CLASS(result, pgsql_result_ce)
|
||||||
Z_PARAM_STR_OR_LONG(field_name, field_offset)
|
Z_PARAM_STR_OR_LONG(field_name, field_offset)
|
||||||
ZEND_PARSE_PARAMETERS_END();
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
} else {
|
} else if (ZEND_NUM_ARGS() == 3) {
|
||||||
ZEND_PARSE_PARAMETERS_START(3, 3)
|
ZEND_PARSE_PARAMETERS_START(3, 3)
|
||||||
Z_PARAM_OBJECT_OF_CLASS(result, pgsql_result_ce)
|
Z_PARAM_OBJECT_OF_CLASS(result, pgsql_result_ce)
|
||||||
if (zend_string_equals_literal(EG(current_execute_data)->func->common.function_name, "pg_result")) {
|
if (zend_string_equals_literal(EG(current_execute_data)->func->common.function_name, "pg_result")) {
|
||||||
|
@ -1720,6 +1720,9 @@ PHP_FUNCTION(pg_fetch_result)
|
||||||
}
|
}
|
||||||
Z_PARAM_STR_OR_LONG(field_name, field_offset)
|
Z_PARAM_STR_OR_LONG(field_name, field_offset)
|
||||||
ZEND_PARSE_PARAMETERS_END();
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
} else {
|
||||||
|
zend_wrong_parameters_count_error(2, 3);
|
||||||
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
pg_result = Z_PGSQL_RESULT_P(result);
|
pg_result = Z_PGSQL_RESULT_P(result);
|
||||||
|
|
16
ext/pgsql/tests/gh17158.phpt
Normal file
16
ext/pgsql/tests/gh17158.phpt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--TEST--
|
||||||
|
GH-17158 (pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument)
|
||||||
|
--EXTENSIONS--
|
||||||
|
pgsql
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
pg_fetch_result(null);
|
||||||
|
} catch (ArgumentCountError $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
pg_fetch_result() expects at least 2 arguments, 1 given
|
Loading…
Add table
Add a link
Reference in a new issue