Skip to content

Commit 9a6c22d

Browse files
committed
Remove deprecated pgsql signatures
As the comment indicates, these are deprecated in PHP 4.2...
1 parent ee9948b commit 9a6c22d

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ PHP 8.0 UPGRADE NOTES
428428
- pgsql:
429429
. The deprecated pg_connect() syntax using multiple parameters instead of a
430430
connection string is no longer supported.
431+
. The deprecated pg_lo_import() and pg_lo_export() signature that passes the
432+
connection as the last argument is no longer supported. The connection
433+
should be passed as first argument instead.
431434

432435
- Phar:
433436
. Metadata associated with a phar will no longer be automatically unserialized,

ext/pgsql/pgsql.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,12 +3298,6 @@ PHP_FUNCTION(pg_lo_import)
32983298
link = FETCH_DEFAULT_LINK();
32993299
CHECK_DEFAULT_LINK(link);
33003300
}
3301-
/* old calling convention, deprecated since PHP 4.2 */
3302-
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
3303-
"pr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
3304-
php_error_docref(NULL, E_NOTICE, "Old API is used");
3305-
link = Z_RES_P(pgsql_link);
3306-
}
33073301
else {
33083302
WRONG_PARAM_COUNT;
33093303
}
@@ -3384,7 +3378,7 @@ PHP_FUNCTION(pg_lo_export)
33843378
link = Z_RES_P(pgsql_link);
33853379
}
33863380
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
3387-
"rss", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
3381+
"rsp", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
33883382
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
33893383
if ((oid_string+oid_strlen) != end_ptr) {
33903384
/* wrong integer format */
@@ -3414,26 +3408,6 @@ PHP_FUNCTION(pg_lo_export)
34143408
link = FETCH_DEFAULT_LINK();
34153409
CHECK_DEFAULT_LINK(link);
34163410
}
3417-
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
3418-
"spr", &oid_string, &oid_strlen, &file_out, &name_len, &pgsql_link) == SUCCESS) {
3419-
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
3420-
if ((oid_string+oid_strlen) != end_ptr) {
3421-
/* wrong integer format */
3422-
php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
3423-
RETURN_FALSE;
3424-
}
3425-
link = Z_RES_P(pgsql_link);
3426-
}
3427-
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
3428-
"lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
3429-
php_error_docref(NULL, E_NOTICE, "Old API is used");
3430-
if (oid_long <= (zend_long)InvalidOid) {
3431-
php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
3432-
RETURN_FALSE;
3433-
}
3434-
oid = (Oid)oid_long;
3435-
link = Z_RES_P(pgsql_link);
3436-
}
34373411
else {
34383412
zend_argument_count_error("Requires 2 or 3 arguments, %d given", ZEND_NUM_ARGS());
34393413
RETURN_THROWS();

ext/pgsql/tests/05large_object.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ $oid = pg_lo_import($db, $path . 'php.gif');
6161
pg_query($db, 'commit');
6262
pg_query($db, 'begin');
6363
@unlink($path . 'php.gif.exported');
64-
pg_lo_export($oid, $path . 'php.gif.exported', $db);
64+
pg_lo_export($db, $oid, $path . 'php.gif.exported');
6565
if (!file_exists($path . 'php.gif.exported')) {
6666
echo "Export failed\n";
6767
}

0 commit comments

Comments
 (0)