Skip to content

Convert resources to objects in ext/pgsql #6791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ PHP NEWS
. PDO SQLite:
. Fixed bug #38334 (Proper data-type support for PDO_SQLITE). (Nikita)

- PgSQL:
. Convert resource<pgsql link> to object \PgSql\Connection. (Máté)
. Convert resource<pgsql result> to object \PgSql\Result. (Máté)
. Convert resource<pgsql large object> to object \PgSql\Lob. (Máté)

- PSpell:
. Convert resource<pspell> to object \PSpell\Dictionary. (Sara)
. Convert resource<pspell config> to object \PSpell\Config. (Sara)
Expand Down
11 changes: 11 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ PHP 8.1 UPGRADE NOTES
types. You can restore the previous behavior by enabling the
PDO::ATTR_STRINGIFY_FETCHES option.

- PgSQL:
. The PgSQL functions now accept and return, respectively, \PgSql\Connection
objects instead of "pgsql link" resources. Return value checks using
is_resource() should be replaced with checks for `false`.
. The PgSQL functions now accept and return, respectively, \PgSql\Result
objects instead of "pgsql result" resources. Return value checks using
is_resource() should be replaced with checks for `false`.
. The PgSQL functions now accept and return, respectively, \PgSql\Lob
objects instead of "pgsql large object" resources. Return value checks
using is_resource() should be replaced with checks for `false`.

- PSpell:
. The PSpell functions now accept and return, respectively, PSpell\Dictionary objects
instead of "pspell" resources. Return value checks using is_resource()
Expand Down
18 changes: 8 additions & 10 deletions Zend/Optimizer/zend_func_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,19 +658,17 @@ static const func_info_t func_infos[] = {
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),

/* ext/pgsql */
FN("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pg_pconnect", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_dbname", MAY_BE_STRING),
F1("pg_options", MAY_BE_STRING),
F1("pg_port", MAY_BE_STRING),
F1("pg_tty", MAY_BE_STRING),
F1("pg_host", MAY_BE_STRING),
F1("pg_version", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_NULL),
F1("pg_parameter_status", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_query", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_query_params", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_prepare", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_execute", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_query", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_query_params", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_prepare", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_execute", MAY_BE_FALSE | MAY_BE_OBJECT),
FN("pg_last_notice", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY ),
F1("pg_field_name", MAY_BE_STRING),
F1("pg_field_type_oid", MAY_BE_LONG | MAY_BE_STRING),
Expand All @@ -683,7 +681,7 @@ static const func_info_t func_infos[] = {
F1("pg_fetch_all_columns", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("pg_last_oid", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
F1("pg_lo_create", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
F1("pg_lo_open", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_lo_open", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_lo_read", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_lo_import", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
F1("pg_copy_to", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
Expand All @@ -694,13 +692,13 @@ static const func_info_t func_infos[] = {
F1("pg_escape_identifier", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_result_error", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_result_error_field", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_get_result", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_get_result", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_result_status", MAY_BE_LONG | MAY_BE_STRING),
F1("pg_get_notify", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("pg_socket", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_socket", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_meta_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("pg_convert", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("pg_insert", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE | MAY_BE_STRING),
F1("pg_insert", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_OBJECT | MAY_BE_STRING),
F1("pg_update", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("pg_delete", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("pg_select", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
Expand Down
Loading