Deprecate pgsql function aliases

These have been documentation-deprecated for a very long time,
make it official.
This commit is contained in:
Nikita Popov 2020-09-21 11:32:00 +02:00
parent 4591cb8a07
commit 7300f6fc17
5 changed files with 75 additions and 27 deletions

View File

@ -844,6 +844,7 @@ PHP 8.0 UPGRADE NOTES
- PGSQL / PDO PGSQL:
. The constant PG_VERSION_STR has now the same value as PG_VERSION, and thus
is deprecated.
. Function aliases in the pgsql extension have been deprecated.
- Zip:
. Using empty file as ZipArchive is deprecated. Libzip 1.6.0

View File

@ -23,6 +23,7 @@ function pg_last_error($connection = null): string {}
/**
* @param resource|null $connection
* @alias pg_last_error
* @deprecated
*/
function pg_errormessage($connection = null): string {}
@ -86,6 +87,7 @@ function pg_num_rows($result): int {}
/**
* @param resource $result
* @alias pg_num_rows
* @deprecated
*/
function pg_numrows($result): int {}
@ -95,6 +97,7 @@ function pg_num_fields($result): int {}
/**
* @param resource $result
* @alias pg_num_fields
* @deprecated
*/
function pg_numfields($result): int {}
@ -104,6 +107,7 @@ function pg_affected_rows($result): int {}
/**
* @param resource $result
* @alias pg_affected_rows
* @deprecated
*/
function pg_cmdtuples($result): int {}
@ -119,6 +123,7 @@ function pg_field_name($result, int $field_number): string|false {}
/**
* @param resource $result
* @alias pg_field_name
* @deprecated
*/
function pg_fieldname($result, int $field_number): string|false {}
@ -128,6 +133,7 @@ function pg_field_size($result, int $field_number): int|false {}
/**
* @param resource $result
* @alias pg_field_size
* @deprecated
*/
function pg_fieldsize($result, int $field_number): int|false {}
@ -137,6 +143,7 @@ function pg_field_type($result, int $field_number): string|false {}
/**
* @param resource $result
* @alias pg_field_type
* @deprecated
*/
function pg_fieldtype($result, int $field_number): string|false {}
@ -149,6 +156,7 @@ function pg_field_num($result, string $field_name): int {}
/**
* @param resource $result
* @alias pg_field_num
* @deprecated
*/
function pg_fieldnum($result, string $field_name): int {}
@ -162,6 +170,7 @@ function pg_fetch_result($result, $row_number, string|int $field = UNKNOWN): str
* @param resource $result
* @param string|int $row_number
* @alias pg_fetch_result
* @deprecated
*/
function pg_result($result, $row_number, string|int $field = UNKNOWN): string|false|null {}
@ -202,6 +211,7 @@ function pg_field_prtlen($result, $row_number, string|int $field = UNKNOWN): int
* @param resource $result
* @param string|int $row_number
* @alias pg_field_prtlen
* @deprecated
*/
function pg_fieldprtlen($result, $row_number, string|int $field = UNKNOWN): int|false {}
@ -215,6 +225,7 @@ function pg_field_is_null($result, $row_number, string|int $field = UNKNOWN): in
* @param resource $result
* @param string|int $row_number
* @alias pg_field_is_null
* @deprecated
*/
function pg_fieldisnull($result, $row_number, string|int $field = UNKNOWN): int|false {}
@ -224,6 +235,7 @@ function pg_free_result($result): bool {}
/**
* @param resource $result
* @alias pg_free_result
* @deprecated
*/
function pg_freeresult($result): bool {}
@ -233,6 +245,7 @@ function pg_last_oid($result): string|int|false {}
/**
* @param resource $result
* @alias pg_last_oid
* @deprecated
*/
function pg_getlastoid($result): string|int|false {}
@ -252,6 +265,7 @@ function pg_lo_create($connection = UNKNOWN, $large_object_id = UNKNOWN): string
* @param resource $connection
* @param string|int $large_object_id
* @alias pg_lo_create
* @deprecated
*/
function pg_locreate($connection = UNKNOWN, $large_object_id = UNKNOWN): string|int|false {}
@ -265,6 +279,7 @@ function pg_lo_unlink($connection, $large_object_id = UNKNOWN): bool {}
* @param resource $connection
* @param string|int $large_object_id
* @alias pg_lo_unlink
* @deprecated
*/
function pg_lounlink($connection, $large_object_id = UNKNOWN): bool {}
@ -280,6 +295,7 @@ function pg_lo_open($connection, $large_object_id = UNKNOWN, string $mode = UNKN
* @param string|int $large_object_id
* @return resource|false
* @alias pg_lo_open
* @deprecated
*/
function pg_loopen($connection, $large_object_id = UNKNOWN, string $mode = UNKNOWN) {}
@ -289,6 +305,7 @@ function pg_lo_close($large_object): bool {}
/**
* @param resource $large_object
* @alias pg_lo_close
* @deprecated
*/
function pg_loclose($large_object): bool {}
@ -298,6 +315,7 @@ function pg_lo_read($large_object, int $len = 8192): string|false {}
/**
* @param resource $large_object
* @alias pg_lo_read
* @deprecated
*/
function pg_loread($large_object, int $len = 8192): string|false {}
@ -307,6 +325,7 @@ function pg_lo_write($large_object, string $buf, ?int $len = null): int|false {}
/**
* @param resource $large_object
* @alias pg_lo_write
* @deprecated
*/
function pg_lowrite($large_object, string $buf, ?int $len = null): int|false {}
@ -316,6 +335,7 @@ function pg_lo_read_all($large_object): int {}
/**
* @param resource $large_object
* @alias pg_lo_read_all
* @deprecated
*/
function pg_loreadall($large_object): int {}
@ -333,6 +353,7 @@ function pg_lo_import($connection, $filename = UNKNOWN, $large_object_id = UNKNO
* @param string|int $large_object_id
* @return resource|false
* @alias pg_lo_import
* @deprecated
*/
function pg_loimport($connection, $filename = UNKNOWN, $large_object_id = UNKNOWN): string|int|false {}
@ -350,6 +371,7 @@ function pg_lo_export($connection, $large_object_id = UNKNOWN, $filename = UNKNO
* @param string|int $filename
* @return resource|false
* @alias pg_lo_export
* @deprecated
*/
function pg_loexport($connection, $large_object_id = UNKNOWN, $filename = UNKNOWN): bool {}
@ -371,6 +393,7 @@ function pg_set_client_encoding($connection, string $encoding = UNKNOWN): int {}
/**
* @param resource|string $connection
* @alias pg_set_client_encoding
* @deprecated
*/
function pg_setclientencoding($connection, string $encoding = UNKNOWN): int {}
@ -380,6 +403,7 @@ function pg_client_encoding($connection = null): string {}
/**
* @param resource|null $connection
* @alias pg_client_encoding
* @deprecated
*/
function pg_clientencoding($connection = null): string {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 907a616e7138369e6e3ccbbb10e6c0f2a380fe93 */
* Stub hash: e5f2c8b3b23876a05a48500f626e81549e5d2ab1 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
@ -539,7 +539,7 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(pg_close, arginfo_pg_close)
ZEND_FE(pg_dbname, arginfo_pg_dbname)
ZEND_FE(pg_last_error, arginfo_pg_last_error)
ZEND_FALIAS(pg_errormessage, pg_last_error, arginfo_pg_errormessage)
ZEND_DEP_FALIAS(pg_errormessage, pg_last_error, arginfo_pg_errormessage)
ZEND_FE(pg_options, arginfo_pg_options)
ZEND_FE(pg_port, arginfo_pg_port)
ZEND_FE(pg_tty, arginfo_pg_tty)
@ -553,24 +553,24 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(pg_prepare, arginfo_pg_prepare)
ZEND_FE(pg_execute, arginfo_pg_execute)
ZEND_FE(pg_num_rows, arginfo_pg_num_rows)
ZEND_FALIAS(pg_numrows, pg_num_rows, arginfo_pg_numrows)
ZEND_DEP_FALIAS(pg_numrows, pg_num_rows, arginfo_pg_numrows)
ZEND_FE(pg_num_fields, arginfo_pg_num_fields)
ZEND_FALIAS(pg_numfields, pg_num_fields, arginfo_pg_numfields)
ZEND_DEP_FALIAS(pg_numfields, pg_num_fields, arginfo_pg_numfields)
ZEND_FE(pg_affected_rows, arginfo_pg_affected_rows)
ZEND_FALIAS(pg_cmdtuples, pg_affected_rows, arginfo_pg_cmdtuples)
ZEND_DEP_FALIAS(pg_cmdtuples, pg_affected_rows, arginfo_pg_cmdtuples)
ZEND_FE(pg_last_notice, arginfo_pg_last_notice)
ZEND_FE(pg_field_table, arginfo_pg_field_table)
ZEND_FE(pg_field_name, arginfo_pg_field_name)
ZEND_FALIAS(pg_fieldname, pg_field_name, arginfo_pg_fieldname)
ZEND_DEP_FALIAS(pg_fieldname, pg_field_name, arginfo_pg_fieldname)
ZEND_FE(pg_field_size, arginfo_pg_field_size)
ZEND_FALIAS(pg_fieldsize, pg_field_size, arginfo_pg_fieldsize)
ZEND_DEP_FALIAS(pg_fieldsize, pg_field_size, arginfo_pg_fieldsize)
ZEND_FE(pg_field_type, arginfo_pg_field_type)
ZEND_FALIAS(pg_fieldtype, pg_field_type, arginfo_pg_fieldtype)
ZEND_DEP_FALIAS(pg_fieldtype, pg_field_type, arginfo_pg_fieldtype)
ZEND_FE(pg_field_type_oid, arginfo_pg_field_type_oid)
ZEND_FE(pg_field_num, arginfo_pg_field_num)
ZEND_FALIAS(pg_fieldnum, pg_field_num, arginfo_pg_fieldnum)
ZEND_DEP_FALIAS(pg_fieldnum, pg_field_num, arginfo_pg_fieldnum)
ZEND_FE(pg_fetch_result, arginfo_pg_fetch_result)
ZEND_FALIAS(pg_result, pg_fetch_result, arginfo_pg_result)
ZEND_DEP_FALIAS(pg_result, pg_fetch_result, arginfo_pg_result)
ZEND_FE(pg_fetch_row, arginfo_pg_fetch_row)
ZEND_FE(pg_fetch_assoc, arginfo_pg_fetch_assoc)
ZEND_FE(pg_fetch_array, arginfo_pg_fetch_array)
@ -579,41 +579,41 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(pg_fetch_all_columns, arginfo_pg_fetch_all_columns)
ZEND_FE(pg_result_seek, arginfo_pg_result_seek)
ZEND_FE(pg_field_prtlen, arginfo_pg_field_prtlen)
ZEND_FALIAS(pg_fieldprtlen, pg_field_prtlen, arginfo_pg_fieldprtlen)
ZEND_DEP_FALIAS(pg_fieldprtlen, pg_field_prtlen, arginfo_pg_fieldprtlen)
ZEND_FE(pg_field_is_null, arginfo_pg_field_is_null)
ZEND_FALIAS(pg_fieldisnull, pg_field_is_null, arginfo_pg_fieldisnull)
ZEND_DEP_FALIAS(pg_fieldisnull, pg_field_is_null, arginfo_pg_fieldisnull)
ZEND_FE(pg_free_result, arginfo_pg_free_result)
ZEND_FALIAS(pg_freeresult, pg_free_result, arginfo_pg_freeresult)
ZEND_DEP_FALIAS(pg_freeresult, pg_free_result, arginfo_pg_freeresult)
ZEND_FE(pg_last_oid, arginfo_pg_last_oid)
ZEND_FALIAS(pg_getlastoid, pg_last_oid, arginfo_pg_getlastoid)
ZEND_DEP_FALIAS(pg_getlastoid, pg_last_oid, arginfo_pg_getlastoid)
ZEND_FE(pg_trace, arginfo_pg_trace)
ZEND_FE(pg_untrace, arginfo_pg_untrace)
ZEND_FE(pg_lo_create, arginfo_pg_lo_create)
ZEND_FALIAS(pg_locreate, pg_lo_create, arginfo_pg_locreate)
ZEND_DEP_FALIAS(pg_locreate, pg_lo_create, arginfo_pg_locreate)
ZEND_FE(pg_lo_unlink, arginfo_pg_lo_unlink)
ZEND_FALIAS(pg_lounlink, pg_lo_unlink, arginfo_pg_lounlink)
ZEND_DEP_FALIAS(pg_lounlink, pg_lo_unlink, arginfo_pg_lounlink)
ZEND_FE(pg_lo_open, arginfo_pg_lo_open)
ZEND_FALIAS(pg_loopen, pg_lo_open, arginfo_pg_loopen)
ZEND_DEP_FALIAS(pg_loopen, pg_lo_open, arginfo_pg_loopen)
ZEND_FE(pg_lo_close, arginfo_pg_lo_close)
ZEND_FALIAS(pg_loclose, pg_lo_close, arginfo_pg_loclose)
ZEND_DEP_FALIAS(pg_loclose, pg_lo_close, arginfo_pg_loclose)
ZEND_FE(pg_lo_read, arginfo_pg_lo_read)
ZEND_FALIAS(pg_loread, pg_lo_read, arginfo_pg_loread)
ZEND_DEP_FALIAS(pg_loread, pg_lo_read, arginfo_pg_loread)
ZEND_FE(pg_lo_write, arginfo_pg_lo_write)
ZEND_FALIAS(pg_lowrite, pg_lo_write, arginfo_pg_lowrite)
ZEND_DEP_FALIAS(pg_lowrite, pg_lo_write, arginfo_pg_lowrite)
ZEND_FE(pg_lo_read_all, arginfo_pg_lo_read_all)
ZEND_FALIAS(pg_loreadall, pg_lo_read_all, arginfo_pg_loreadall)
ZEND_DEP_FALIAS(pg_loreadall, pg_lo_read_all, arginfo_pg_loreadall)
ZEND_FE(pg_lo_import, arginfo_pg_lo_import)
ZEND_FALIAS(pg_loimport, pg_lo_import, arginfo_pg_loimport)
ZEND_DEP_FALIAS(pg_loimport, pg_lo_import, arginfo_pg_loimport)
ZEND_FE(pg_lo_export, arginfo_pg_lo_export)
ZEND_FALIAS(pg_loexport, pg_lo_export, arginfo_pg_loexport)
ZEND_DEP_FALIAS(pg_loexport, pg_lo_export, arginfo_pg_loexport)
ZEND_FE(pg_lo_seek, arginfo_pg_lo_seek)
ZEND_FE(pg_lo_tell, arginfo_pg_lo_tell)
ZEND_FE(pg_lo_truncate, arginfo_pg_lo_truncate)
ZEND_FE(pg_set_error_verbosity, arginfo_pg_set_error_verbosity)
ZEND_FE(pg_set_client_encoding, arginfo_pg_set_client_encoding)
ZEND_FALIAS(pg_setclientencoding, pg_set_client_encoding, arginfo_pg_setclientencoding)
ZEND_DEP_FALIAS(pg_setclientencoding, pg_set_client_encoding, arginfo_pg_setclientencoding)
ZEND_FE(pg_client_encoding, arginfo_pg_client_encoding)
ZEND_FALIAS(pg_clientencoding, pg_client_encoding, arginfo_pg_clientencoding)
ZEND_DEP_FALIAS(pg_clientencoding, pg_client_encoding, arginfo_pg_clientencoding)
ZEND_FE(pg_end_copy, arginfo_pg_end_copy)
ZEND_FE(pg_put_line, arginfo_pg_put_line)
ZEND_FE(pg_copy_to, arginfo_pg_copy_to)

View File

@ -29,5 +29,28 @@ pg_cmdtuples($result);
echo "OK";
?>
--EXPECT--
--EXPECTF--
Deprecated: Function pg_numrows() is deprecated in %s on line %d
Deprecated: Function pg_numfields() is deprecated in %s on line %d
Deprecated: Function pg_fieldname() is deprecated in %s on line %d
Deprecated: Function pg_fieldsize() is deprecated in %s on line %d
Deprecated: Function pg_fieldtype() is deprecated in %s on line %d
Deprecated: Function pg_fieldprtlen() is deprecated in %s on line %d
Deprecated: Function pg_fieldisnull() is deprecated in %s on line %d
Deprecated: Function pg_result() is deprecated in %s on line %d
Deprecated: Function pg_getlastoid() is deprecated in %s on line %d
Deprecated: Function pg_freeresult() is deprecated in %s on line %d
Deprecated: Function pg_errormessage() is deprecated in %s on line %d
Deprecated: Function pg_cmdtuples() is deprecated in %s on line %d
OK

View File

@ -9,7 +9,7 @@ function _skip_lc_messages($lc_messages = 'C')
function _set_lc_messages($lc_messages = 'C')
{
if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
if (pg_fetch_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
return false;
}