Skip to content

Commit 5b3712e

Browse files
committed
ext/pgsql: remove deprecated default link support
1 parent 655f116 commit 5b3712e

15 files changed

+323
-575
lines changed

ext/pgsql/pgsql.c

Lines changed: 245 additions & 273 deletions
Large diffs are not rendered by default.

ext/pgsql/pgsql.stub.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -489,76 +489,76 @@ function pg_pconnect(string $connection_string, int $flags = 0): PgSql\Connectio
489489

490490
function pg_connect_poll(PgSql\Connection $connection): int {}
491491

492-
function pg_close(?PgSql\Connection $connection = null): true {}
492+
function pg_close(PgSql\Connection $connection): true {}
493493

494494
/** @refcount 1 */
495-
function pg_dbname(?PgSql\Connection $connection = null): string {}
495+
function pg_dbname(PgSql\Connection $connection): string {}
496496

497-
function pg_last_error(?PgSql\Connection $connection = null): string {}
497+
function pg_last_error(PgSql\Connection $connection): string {}
498498

499499
/**
500500
* @alias pg_last_error
501501
* @deprecated
502502
*/
503-
function pg_errormessage(?PgSql\Connection $connection = null): string {}
503+
function pg_errormessage(PgSql\Connection $connection): string {}
504504

505505
/** @refcount 1 */
506-
function pg_options(?PgSql\Connection $connection = null): string {}
506+
function pg_options(PgSql\Connection $connection): string {}
507507

508508
/** @refcount 1 */
509-
function pg_port(?PgSql\Connection $connection = null): string {}
509+
function pg_port(PgSql\Connection $connection): string {}
510510

511511
/** @refcount 1 */
512-
function pg_tty(?PgSql\Connection $connection = null): string {}
512+
function pg_tty(PgSql\Connection $connection): string {}
513513

514514
/** @refcount 1 */
515-
function pg_host(?PgSql\Connection $connection = null): string {}
515+
function pg_host(PgSql\Connection $connection): string {}
516516

517517
/**
518518
* @return array<string, int|string|null>
519519
* @refcount 1
520520
*/
521-
function pg_version(?PgSql\Connection $connection = null): array {}
521+
function pg_version(PgSql\Connection $connection): array {}
522522

523523
/**
524524
* @param PgSql\Connection|string $connection
525525
* @refcount 1
526526
*/
527-
function pg_parameter_status($connection, string $name = UNKNOWN): string|false {}
527+
function pg_parameter_status($connection, string $name): string|false {}
528528

529-
function pg_ping(?PgSql\Connection $connection = null): bool {}
529+
function pg_ping(PgSql\Connection $connection): bool {}
530530

531531
/**
532532
* @param PgSql\Connection|string $connection
533533
* @refcount 1
534534
*/
535-
function pg_query($connection, string $query = UNKNOWN): PgSql\Result|false {}
535+
function pg_query($connection, string $query): PgSql\Result|false {}
536536

537537
/**
538538
* @param PgSql\Connection|string $connection
539539
* @alias pg_query
540540
*/
541-
function pg_exec($connection, string $query = UNKNOWN): PgSql\Result|false {}
541+
function pg_exec($connection, string $query): PgSql\Result|false {}
542542

543543
/**
544544
* @param PgSql\Connection|string $connection
545545
* @param string|array $query
546546
* @refcount 1
547547
*/
548-
function pg_query_params($connection, $query, array $params = UNKNOWN): PgSql\Result|false {}
548+
function pg_query_params($connection, $query, array $params): PgSql\Result|false {}
549549

550550
/**
551551
* @param PgSql\Connection|string $connection
552552
* @refcount 1
553553
*/
554-
function pg_prepare($connection, string $statement_name, string $query = UNKNOWN): PgSql\Result|false {}
554+
function pg_prepare($connection, string $statement_name, string $query): PgSql\Result|false {}
555555

556556
/**
557557
* @param PgSql\Connection|string $connection
558558
* @param string|array $statement_name
559559
* @refcount 1
560560
*/
561-
function pg_execute($connection, $statement_name, array $params = UNKNOWN): PgSql\Result|false {}
561+
function pg_execute($connection, $statement_name, array $params): PgSql\Result|false {}
562562

563563
function pg_num_rows(PgSql\Result $result): int {}
564564

@@ -707,9 +707,9 @@ function pg_last_oid(PgSql\Result $result): string|int|false {}
707707
*/
708708
function pg_getlastoid(PgSql\Result $result): string|int|false {}
709709

710-
function pg_trace(string $filename, string $mode = "w", ?PgSql\Connection $connection = null, int $trace_mode = 0): bool {}
710+
function pg_trace(string $filename, string $mode = "w", PgSql\Connection $connection, int $trace_mode = 0): bool {}
711711

712-
function pg_untrace(?PgSql\Connection $connection = null): true {}
712+
function pg_untrace(PgSql\Connection $connection): true {}
713713

714714
/**
715715
* @param PgSql\Connection $connection
@@ -840,15 +840,15 @@ function pg_set_client_encoding($connection, string $encoding = UNKNOWN): int {}
840840
*/
841841
function pg_setclientencoding($connection, string $encoding = UNKNOWN): int {}
842842

843-
function pg_client_encoding(?PgSql\Connection $connection = null): string {}
843+
function pg_client_encoding(PgSql\Connection $connection): string {}
844844

845845
/**
846846
* @alias pg_client_encoding
847847
* @deprecated
848848
*/
849-
function pg_clientencoding(?PgSql\Connection $connection = null): string {}
849+
function pg_clientencoding(PgSql\Connection $connection): string {}
850850

851-
function pg_end_copy(?PgSql\Connection $connection = null): bool {}
851+
function pg_end_copy(PgSql\Connection $connection): bool {}
852852

853853
/** @param PgSql\Connection|string $connection */
854854
function pg_put_line($connection, string $query = UNKNOWN): bool {}

ext/pgsql/pgsql_arginfo.h

Lines changed: 20 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/pgsql/php_pgsql.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ ZEND_BEGIN_MODULE_GLOBALS(pgsql)
187187
zend_long allow_persistent;
188188
zend_long auto_reset_persistent;
189189
int ignore_notices,log_notices;
190-
zend_object *default_link; /* default link when connection is omitted */
191190
HashTable field_oids;
192191
HashTable table_oids;
193192
HashTable connections;

ext/pgsql/tests/05large_object.phpt

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ pg_exec ($db, "begin");
5252
pg_lo_unlink($db, $oid) or print("pg_lo_unlink() error 1\n");
5353
pg_exec ($db, "commit");
5454

55-
// more pg_lo_unlink() tests
56-
echo "Test without connection\n";
57-
pg_exec ($db, "begin");
58-
$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
59-
pg_lo_unlink($oid) or print("pg_lo_unlink() error 2\n");
60-
pg_exec ($db, "commit");
61-
6255
echo "Test with string oid value\n";
6356
pg_exec ($db, "begin");
6457
$oid = pg_lo_create ($db) or print("pg_lo_create() error\n");
@@ -80,21 +73,11 @@ if (!file_exists($path . 'php.gif.exported')) {
8073
pg_query($db, 'commit');
8174

8275
/* invalid OID values */
83-
try {
84-
pg_lo_create(-15);
85-
} catch (\ValueError $e) {
86-
echo $e->getMessage(), \PHP_EOL;
87-
}
8876
try {
8977
pg_lo_create($db, -15);
9078
} catch (\ValueError $e) {
9179
echo $e->getMessage(), \PHP_EOL;
9280
}
93-
try {
94-
pg_lo_create('giberrish');
95-
} catch (\ValueError $e) {
96-
echo $e->getMessage(), \PHP_EOL;
97-
}
9881
try {
9982
pg_lo_create($db, 'giberrish');
10083
} catch (\ValueError $e) {
@@ -107,29 +90,20 @@ echo "OK";
10790
create/write/close LO
10891
open/read/tell/seek/close LO
10992
string(5) "large"
110-
int(5)
93+
int(%d)
11194
bool(true)
11295
string(10) "bject data"
113-
int(17)
96+
int(%d)
11497
bool(true)
11598
string(17) "large object data"
11699
bool(true)
117100
string(4) "data"
118101
open/read_all/close LO
119102
large object data
120-
int(17)
103+
int(%d)
121104
unlink LO
122-
Test without connection
123-
124-
Deprecated: pg_lo_unlink(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
125105
Test with string oid value
126106
import/export LO
127-
128-
Deprecated: pg_lo_create(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
129-
Invalid OID value passed
130-
Invalid OID value passed
131-
132-
Deprecated: pg_lo_create(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
133107
Invalid OID value passed
134108
Invalid OID value passed
135109
OK

ext/pgsql/tests/08escape.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ else {
9999

100100
?>
101101
--EXPECTF--
102-
Deprecated: pg_escape_string(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
103102
pg_escape_string() is Ok
104-
105-
Deprecated: pg_escape_bytea(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
106103
pg_escape_bytea() is Ok
107104
pg_escape_bytea() actually works with database
108105
pg_escape_literal() is Ok

ext/pgsql/tests/18pg_escape_bytea_before.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@ else {
2929
}
3030
?>
3131
--EXPECTF--
32-
Deprecated: pg_escape_bytea(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
3332
OK

ext/pgsql/tests/27large_object_oid.phpt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,9 @@ if ($oid != 21001) echo ("pg_lo_create() wrong id\n");
3232
pg_lo_unlink ($db, $oid);
3333
pg_exec ($db, "commit");
3434

35-
echo "create LO using default connection\n";
36-
pg_exec ("begin");
37-
$oid = pg_lo_create (21002);
38-
if (!$oid) echo ("pg_lo_create() error\n");
39-
if ($oid != 21002) echo ("pg_lo_create() wrong id\n");
40-
pg_lo_unlink ($oid);
41-
pg_exec ("commit");
42-
4335
echo "OK";
4436
?>
4537
--EXPECTF--
4638
create LO from int
4739
create LO from string
48-
create LO using default connection
49-
50-
Deprecated: pg_exec(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
51-
52-
Deprecated: pg_lo_create(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
53-
54-
Deprecated: pg_lo_unlink(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
55-
56-
Deprecated: pg_exec(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d
5740
OK

0 commit comments

Comments
 (0)