Skip to content

Commit

Permalink
Remove deprecated pgsql signatures
Browse files Browse the repository at this point in the history
As the comment indicates, these are deprecated in PHP 4.2...
  • Loading branch information
nikic committed Sep 9, 2020
1 parent ee9948b commit 9a6c22d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
3 changes: 3 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ PHP 8.0 UPGRADE NOTES
- pgsql:
. The deprecated pg_connect() syntax using multiple parameters instead of a
connection string is no longer supported.
. The deprecated pg_lo_import() and pg_lo_export() signature that passes the
connection as the last argument is no longer supported. The connection
should be passed as first argument instead.

- Phar:
. Metadata associated with a phar will no longer be automatically unserialized,
Expand Down
28 changes: 1 addition & 27 deletions ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -3298,12 +3298,6 @@ PHP_FUNCTION(pg_lo_import)
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
}
/* old calling convention, deprecated since PHP 4.2 */
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"pr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
php_error_docref(NULL, E_NOTICE, "Old API is used");
link = Z_RES_P(pgsql_link);
}
else {
WRONG_PARAM_COUNT;
}
Expand Down Expand Up @@ -3384,7 +3378,7 @@ PHP_FUNCTION(pg_lo_export)
link = Z_RES_P(pgsql_link);
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rss", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
"rsp", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
Expand Down Expand Up @@ -3414,26 +3408,6 @@ PHP_FUNCTION(pg_lo_export)
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"spr", &oid_string, &oid_strlen, &file_out, &name_len, &pgsql_link) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
link = Z_RES_P(pgsql_link);
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
php_error_docref(NULL, E_NOTICE, "Old API is used");
if (oid_long <= (zend_long)InvalidOid) {
php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
link = Z_RES_P(pgsql_link);
}
else {
zend_argument_count_error("Requires 2 or 3 arguments, %d given", ZEND_NUM_ARGS());
RETURN_THROWS();
Expand Down
2 changes: 1 addition & 1 deletion ext/pgsql/tests/05large_object.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $oid = pg_lo_import($db, $path . 'php.gif');
pg_query($db, 'commit');
pg_query($db, 'begin');
@unlink($path . 'php.gif.exported');
pg_lo_export($oid, $path . 'php.gif.exported', $db);
pg_lo_export($db, $oid, $path . 'php.gif.exported');
if (!file_exists($path . 'php.gif.exported')) {
echo "Export failed\n";
}
Expand Down

0 comments on commit 9a6c22d

Please sign in to comment.