Skip to content

Commit 7300f6f

Browse files
committed
Deprecate pgsql function aliases
These have been documentation-deprecated for a very long time, make it official.
1 parent 4591cb8 commit 7300f6f

File tree

5 files changed

+75
-27
lines changed

5 files changed

+75
-27
lines changed

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ PHP 8.0 UPGRADE NOTES
844844
- PGSQL / PDO PGSQL:
845845
. The constant PG_VERSION_STR has now the same value as PG_VERSION, and thus
846846
is deprecated.
847+
. Function aliases in the pgsql extension have been deprecated.
847848

848849
- Zip:
849850
. Using empty file as ZipArchive is deprecated. Libzip 1.6.0

ext/pgsql/pgsql.stub.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function pg_last_error($connection = null): string {}
2323
/**
2424
* @param resource|null $connection
2525
* @alias pg_last_error
26+
* @deprecated
2627
*/
2728
function pg_errormessage($connection = null): string {}
2829

@@ -86,6 +87,7 @@ function pg_num_rows($result): int {}
8687
/**
8788
* @param resource $result
8889
* @alias pg_num_rows
90+
* @deprecated
8991
*/
9092
function pg_numrows($result): int {}
9193

@@ -95,6 +97,7 @@ function pg_num_fields($result): int {}
9597
/**
9698
* @param resource $result
9799
* @alias pg_num_fields
100+
* @deprecated
98101
*/
99102
function pg_numfields($result): int {}
100103

@@ -104,6 +107,7 @@ function pg_affected_rows($result): int {}
104107
/**
105108
* @param resource $result
106109
* @alias pg_affected_rows
110+
* @deprecated
107111
*/
108112
function pg_cmdtuples($result): int {}
109113

@@ -119,6 +123,7 @@ function pg_field_name($result, int $field_number): string|false {}
119123
/**
120124
* @param resource $result
121125
* @alias pg_field_name
126+
* @deprecated
122127
*/
123128
function pg_fieldname($result, int $field_number): string|false {}
124129

@@ -128,6 +133,7 @@ function pg_field_size($result, int $field_number): int|false {}
128133
/**
129134
* @param resource $result
130135
* @alias pg_field_size
136+
* @deprecated
131137
*/
132138
function pg_fieldsize($result, int $field_number): int|false {}
133139

@@ -137,6 +143,7 @@ function pg_field_type($result, int $field_number): string|false {}
137143
/**
138144
* @param resource $result
139145
* @alias pg_field_type
146+
* @deprecated
140147
*/
141148
function pg_fieldtype($result, int $field_number): string|false {}
142149

@@ -149,6 +156,7 @@ function pg_field_num($result, string $field_name): int {}
149156
/**
150157
* @param resource $result
151158
* @alias pg_field_num
159+
* @deprecated
152160
*/
153161
function pg_fieldnum($result, string $field_name): int {}
154162

@@ -162,6 +170,7 @@ function pg_fetch_result($result, $row_number, string|int $field = UNKNOWN): str
162170
* @param resource $result
163171
* @param string|int $row_number
164172
* @alias pg_fetch_result
173+
* @deprecated
165174
*/
166175
function pg_result($result, $row_number, string|int $field = UNKNOWN): string|false|null {}
167176

@@ -202,6 +211,7 @@ function pg_field_prtlen($result, $row_number, string|int $field = UNKNOWN): int
202211
* @param resource $result
203212
* @param string|int $row_number
204213
* @alias pg_field_prtlen
214+
* @deprecated
205215
*/
206216
function pg_fieldprtlen($result, $row_number, string|int $field = UNKNOWN): int|false {}
207217

@@ -215,6 +225,7 @@ function pg_field_is_null($result, $row_number, string|int $field = UNKNOWN): in
215225
* @param resource $result
216226
* @param string|int $row_number
217227
* @alias pg_field_is_null
228+
* @deprecated
218229
*/
219230
function pg_fieldisnull($result, $row_number, string|int $field = UNKNOWN): int|false {}
220231

@@ -224,6 +235,7 @@ function pg_free_result($result): bool {}
224235
/**
225236
* @param resource $result
226237
* @alias pg_free_result
238+
* @deprecated
227239
*/
228240
function pg_freeresult($result): bool {}
229241

@@ -233,6 +245,7 @@ function pg_last_oid($result): string|int|false {}
233245
/**
234246
* @param resource $result
235247
* @alias pg_last_oid
248+
* @deprecated
236249
*/
237250
function pg_getlastoid($result): string|int|false {}
238251

@@ -252,6 +265,7 @@ function pg_lo_create($connection = UNKNOWN, $large_object_id = UNKNOWN): string
252265
* @param resource $connection
253266
* @param string|int $large_object_id
254267
* @alias pg_lo_create
268+
* @deprecated
255269
*/
256270
function pg_locreate($connection = UNKNOWN, $large_object_id = UNKNOWN): string|int|false {}
257271

@@ -265,6 +279,7 @@ function pg_lo_unlink($connection, $large_object_id = UNKNOWN): bool {}
265279
* @param resource $connection
266280
* @param string|int $large_object_id
267281
* @alias pg_lo_unlink
282+
* @deprecated
268283
*/
269284
function pg_lounlink($connection, $large_object_id = UNKNOWN): bool {}
270285

@@ -280,6 +295,7 @@ function pg_lo_open($connection, $large_object_id = UNKNOWN, string $mode = UNKN
280295
* @param string|int $large_object_id
281296
* @return resource|false
282297
* @alias pg_lo_open
298+
* @deprecated
283299
*/
284300
function pg_loopen($connection, $large_object_id = UNKNOWN, string $mode = UNKNOWN) {}
285301

@@ -289,6 +305,7 @@ function pg_lo_close($large_object): bool {}
289305
/**
290306
* @param resource $large_object
291307
* @alias pg_lo_close
308+
* @deprecated
292309
*/
293310
function pg_loclose($large_object): bool {}
294311

@@ -298,6 +315,7 @@ function pg_lo_read($large_object, int $len = 8192): string|false {}
298315
/**
299316
* @param resource $large_object
300317
* @alias pg_lo_read
318+
* @deprecated
301319
*/
302320
function pg_loread($large_object, int $len = 8192): string|false {}
303321

@@ -307,6 +325,7 @@ function pg_lo_write($large_object, string $buf, ?int $len = null): int|false {}
307325
/**
308326
* @param resource $large_object
309327
* @alias pg_lo_write
328+
* @deprecated
310329
*/
311330
function pg_lowrite($large_object, string $buf, ?int $len = null): int|false {}
312331

@@ -316,6 +335,7 @@ function pg_lo_read_all($large_object): int {}
316335
/**
317336
* @param resource $large_object
318337
* @alias pg_lo_read_all
338+
* @deprecated
319339
*/
320340
function pg_loreadall($large_object): int {}
321341

@@ -333,6 +353,7 @@ function pg_lo_import($connection, $filename = UNKNOWN, $large_object_id = UNKNO
333353
* @param string|int $large_object_id
334354
* @return resource|false
335355
* @alias pg_lo_import
356+
* @deprecated
336357
*/
337358
function pg_loimport($connection, $filename = UNKNOWN, $large_object_id = UNKNOWN): string|int|false {}
338359

@@ -350,6 +371,7 @@ function pg_lo_export($connection, $large_object_id = UNKNOWN, $filename = UNKNO
350371
* @param string|int $filename
351372
* @return resource|false
352373
* @alias pg_lo_export
374+
* @deprecated
353375
*/
354376
function pg_loexport($connection, $large_object_id = UNKNOWN, $filename = UNKNOWN): bool {}
355377

@@ -371,6 +393,7 @@ function pg_set_client_encoding($connection, string $encoding = UNKNOWN): int {}
371393
/**
372394
* @param resource|string $connection
373395
* @alias pg_set_client_encoding
396+
* @deprecated
374397
*/
375398
function pg_setclientencoding($connection, string $encoding = UNKNOWN): int {}
376399

@@ -380,6 +403,7 @@ function pg_client_encoding($connection = null): string {}
380403
/**
381404
* @param resource|null $connection
382405
* @alias pg_client_encoding
406+
* @deprecated
383407
*/
384408
function pg_clientencoding($connection = null): string {}
385409

ext/pgsql/pgsql_arginfo.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 907a616e7138369e6e3ccbbb10e6c0f2a380fe93 */
2+
* Stub hash: e5f2c8b3b23876a05a48500f626e81549e5d2ab1 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
@@ -539,7 +539,7 @@ static const zend_function_entry ext_functions[] = {
539539
ZEND_FE(pg_close, arginfo_pg_close)
540540
ZEND_FE(pg_dbname, arginfo_pg_dbname)
541541
ZEND_FE(pg_last_error, arginfo_pg_last_error)
542-
ZEND_FALIAS(pg_errormessage, pg_last_error, arginfo_pg_errormessage)
542+
ZEND_DEP_FALIAS(pg_errormessage, pg_last_error, arginfo_pg_errormessage)
543543
ZEND_FE(pg_options, arginfo_pg_options)
544544
ZEND_FE(pg_port, arginfo_pg_port)
545545
ZEND_FE(pg_tty, arginfo_pg_tty)
@@ -553,24 +553,24 @@ static const zend_function_entry ext_functions[] = {
553553
ZEND_FE(pg_prepare, arginfo_pg_prepare)
554554
ZEND_FE(pg_execute, arginfo_pg_execute)
555555
ZEND_FE(pg_num_rows, arginfo_pg_num_rows)
556-
ZEND_FALIAS(pg_numrows, pg_num_rows, arginfo_pg_numrows)
556+
ZEND_DEP_FALIAS(pg_numrows, pg_num_rows, arginfo_pg_numrows)
557557
ZEND_FE(pg_num_fields, arginfo_pg_num_fields)
558-
ZEND_FALIAS(pg_numfields, pg_num_fields, arginfo_pg_numfields)
558+
ZEND_DEP_FALIAS(pg_numfields, pg_num_fields, arginfo_pg_numfields)
559559
ZEND_FE(pg_affected_rows, arginfo_pg_affected_rows)
560-
ZEND_FALIAS(pg_cmdtuples, pg_affected_rows, arginfo_pg_cmdtuples)
560+
ZEND_DEP_FALIAS(pg_cmdtuples, pg_affected_rows, arginfo_pg_cmdtuples)
561561
ZEND_FE(pg_last_notice, arginfo_pg_last_notice)
562562
ZEND_FE(pg_field_table, arginfo_pg_field_table)
563563
ZEND_FE(pg_field_name, arginfo_pg_field_name)
564-
ZEND_FALIAS(pg_fieldname, pg_field_name, arginfo_pg_fieldname)
564+
ZEND_DEP_FALIAS(pg_fieldname, pg_field_name, arginfo_pg_fieldname)
565565
ZEND_FE(pg_field_size, arginfo_pg_field_size)
566-
ZEND_FALIAS(pg_fieldsize, pg_field_size, arginfo_pg_fieldsize)
566+
ZEND_DEP_FALIAS(pg_fieldsize, pg_field_size, arginfo_pg_fieldsize)
567567
ZEND_FE(pg_field_type, arginfo_pg_field_type)
568-
ZEND_FALIAS(pg_fieldtype, pg_field_type, arginfo_pg_fieldtype)
568+
ZEND_DEP_FALIAS(pg_fieldtype, pg_field_type, arginfo_pg_fieldtype)
569569
ZEND_FE(pg_field_type_oid, arginfo_pg_field_type_oid)
570570
ZEND_FE(pg_field_num, arginfo_pg_field_num)
571-
ZEND_FALIAS(pg_fieldnum, pg_field_num, arginfo_pg_fieldnum)
571+
ZEND_DEP_FALIAS(pg_fieldnum, pg_field_num, arginfo_pg_fieldnum)
572572
ZEND_FE(pg_fetch_result, arginfo_pg_fetch_result)
573-
ZEND_FALIAS(pg_result, pg_fetch_result, arginfo_pg_result)
573+
ZEND_DEP_FALIAS(pg_result, pg_fetch_result, arginfo_pg_result)
574574
ZEND_FE(pg_fetch_row, arginfo_pg_fetch_row)
575575
ZEND_FE(pg_fetch_assoc, arginfo_pg_fetch_assoc)
576576
ZEND_FE(pg_fetch_array, arginfo_pg_fetch_array)
@@ -579,41 +579,41 @@ static const zend_function_entry ext_functions[] = {
579579
ZEND_FE(pg_fetch_all_columns, arginfo_pg_fetch_all_columns)
580580
ZEND_FE(pg_result_seek, arginfo_pg_result_seek)
581581
ZEND_FE(pg_field_prtlen, arginfo_pg_field_prtlen)
582-
ZEND_FALIAS(pg_fieldprtlen, pg_field_prtlen, arginfo_pg_fieldprtlen)
582+
ZEND_DEP_FALIAS(pg_fieldprtlen, pg_field_prtlen, arginfo_pg_fieldprtlen)
583583
ZEND_FE(pg_field_is_null, arginfo_pg_field_is_null)
584-
ZEND_FALIAS(pg_fieldisnull, pg_field_is_null, arginfo_pg_fieldisnull)
584+
ZEND_DEP_FALIAS(pg_fieldisnull, pg_field_is_null, arginfo_pg_fieldisnull)
585585
ZEND_FE(pg_free_result, arginfo_pg_free_result)
586-
ZEND_FALIAS(pg_freeresult, pg_free_result, arginfo_pg_freeresult)
586+
ZEND_DEP_FALIAS(pg_freeresult, pg_free_result, arginfo_pg_freeresult)
587587
ZEND_FE(pg_last_oid, arginfo_pg_last_oid)
588-
ZEND_FALIAS(pg_getlastoid, pg_last_oid, arginfo_pg_getlastoid)
588+
ZEND_DEP_FALIAS(pg_getlastoid, pg_last_oid, arginfo_pg_getlastoid)
589589
ZEND_FE(pg_trace, arginfo_pg_trace)
590590
ZEND_FE(pg_untrace, arginfo_pg_untrace)
591591
ZEND_FE(pg_lo_create, arginfo_pg_lo_create)
592-
ZEND_FALIAS(pg_locreate, pg_lo_create, arginfo_pg_locreate)
592+
ZEND_DEP_FALIAS(pg_locreate, pg_lo_create, arginfo_pg_locreate)
593593
ZEND_FE(pg_lo_unlink, arginfo_pg_lo_unlink)
594-
ZEND_FALIAS(pg_lounlink, pg_lo_unlink, arginfo_pg_lounlink)
594+
ZEND_DEP_FALIAS(pg_lounlink, pg_lo_unlink, arginfo_pg_lounlink)
595595
ZEND_FE(pg_lo_open, arginfo_pg_lo_open)
596-
ZEND_FALIAS(pg_loopen, pg_lo_open, arginfo_pg_loopen)
596+
ZEND_DEP_FALIAS(pg_loopen, pg_lo_open, arginfo_pg_loopen)
597597
ZEND_FE(pg_lo_close, arginfo_pg_lo_close)
598-
ZEND_FALIAS(pg_loclose, pg_lo_close, arginfo_pg_loclose)
598+
ZEND_DEP_FALIAS(pg_loclose, pg_lo_close, arginfo_pg_loclose)
599599
ZEND_FE(pg_lo_read, arginfo_pg_lo_read)
600-
ZEND_FALIAS(pg_loread, pg_lo_read, arginfo_pg_loread)
600+
ZEND_DEP_FALIAS(pg_loread, pg_lo_read, arginfo_pg_loread)
601601
ZEND_FE(pg_lo_write, arginfo_pg_lo_write)
602-
ZEND_FALIAS(pg_lowrite, pg_lo_write, arginfo_pg_lowrite)
602+
ZEND_DEP_FALIAS(pg_lowrite, pg_lo_write, arginfo_pg_lowrite)
603603
ZEND_FE(pg_lo_read_all, arginfo_pg_lo_read_all)
604-
ZEND_FALIAS(pg_loreadall, pg_lo_read_all, arginfo_pg_loreadall)
604+
ZEND_DEP_FALIAS(pg_loreadall, pg_lo_read_all, arginfo_pg_loreadall)
605605
ZEND_FE(pg_lo_import, arginfo_pg_lo_import)
606-
ZEND_FALIAS(pg_loimport, pg_lo_import, arginfo_pg_loimport)
606+
ZEND_DEP_FALIAS(pg_loimport, pg_lo_import, arginfo_pg_loimport)
607607
ZEND_FE(pg_lo_export, arginfo_pg_lo_export)
608-
ZEND_FALIAS(pg_loexport, pg_lo_export, arginfo_pg_loexport)
608+
ZEND_DEP_FALIAS(pg_loexport, pg_lo_export, arginfo_pg_loexport)
609609
ZEND_FE(pg_lo_seek, arginfo_pg_lo_seek)
610610
ZEND_FE(pg_lo_tell, arginfo_pg_lo_tell)
611611
ZEND_FE(pg_lo_truncate, arginfo_pg_lo_truncate)
612612
ZEND_FE(pg_set_error_verbosity, arginfo_pg_set_error_verbosity)
613613
ZEND_FE(pg_set_client_encoding, arginfo_pg_set_client_encoding)
614-
ZEND_FALIAS(pg_setclientencoding, pg_set_client_encoding, arginfo_pg_setclientencoding)
614+
ZEND_DEP_FALIAS(pg_setclientencoding, pg_set_client_encoding, arginfo_pg_setclientencoding)
615615
ZEND_FE(pg_client_encoding, arginfo_pg_client_encoding)
616-
ZEND_FALIAS(pg_clientencoding, pg_client_encoding, arginfo_pg_clientencoding)
616+
ZEND_DEP_FALIAS(pg_clientencoding, pg_client_encoding, arginfo_pg_clientencoding)
617617
ZEND_FE(pg_end_copy, arginfo_pg_end_copy)
618618
ZEND_FE(pg_put_line, arginfo_pg_put_line)
619619
ZEND_FE(pg_copy_to, arginfo_pg_copy_to)

ext/pgsql/tests/98old_api.phpt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,28 @@ pg_cmdtuples($result);
2929

3030
echo "OK";
3131
?>
32-
--EXPECT--
32+
--EXPECTF--
33+
Deprecated: Function pg_numrows() is deprecated in %s on line %d
34+
35+
Deprecated: Function pg_numfields() is deprecated in %s on line %d
36+
37+
Deprecated: Function pg_fieldname() is deprecated in %s on line %d
38+
39+
Deprecated: Function pg_fieldsize() is deprecated in %s on line %d
40+
41+
Deprecated: Function pg_fieldtype() is deprecated in %s on line %d
42+
43+
Deprecated: Function pg_fieldprtlen() is deprecated in %s on line %d
44+
45+
Deprecated: Function pg_fieldisnull() is deprecated in %s on line %d
46+
47+
Deprecated: Function pg_result() is deprecated in %s on line %d
48+
49+
Deprecated: Function pg_getlastoid() is deprecated in %s on line %d
50+
51+
Deprecated: Function pg_freeresult() is deprecated in %s on line %d
52+
53+
Deprecated: Function pg_errormessage() is deprecated in %s on line %d
54+
55+
Deprecated: Function pg_cmdtuples() is deprecated in %s on line %d
3356
OK

ext/pgsql/tests/lcmess.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function _skip_lc_messages($lc_messages = 'C')
99

1010
function _set_lc_messages($lc_messages = 'C')
1111
{
12-
if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
12+
if (pg_fetch_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
1313
if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
1414
return false;
1515
}

0 commit comments

Comments
 (0)