You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument #17158
PHP Fatal error: Uncaught ArgumentCountError: pg_fetch_result() expects 2 or 3 arguments, 1 given
[The documentation](https://www.php.net/manual/en/function.pg-fetch-result.php) is unclear, as it says the 2nd argument (row), may be omitted, but does not say the 3rd argument (field) may be omitted.
The code pg_fetch_result($pgResult, null); does work and returns the first field of the first row.
I think the documentation needs to be updated as well as the error message.
Activity
ndossche commentedon Dec 14, 2024
This is because the way the argument parsing is implemented is strange:
php-src/ext/pgsql/pgsql.c
Lines 1884 to 1907 in c015242
This can be solved by adding another branch that checks whether not enough arguments for both cases are passed.
Fix phpGH-17158: pg_fetch_result Shows Incorrect ArgumentCountError M…
Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Mess…
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4'