mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fix GH-10672 (pg_lo_open segfaults in the strict_types mode)
We need to use the proper ZPP qualifier for zend_string Closes GH-10677
This commit is contained in:
parent
8d1c0a1403
commit
5f357f341d
3
NEWS
3
NEWS
@ -50,6 +50,9 @@ PHP NEWS
|
||||
. Fixed bug #60994 (Reading a multibyte CLOB caps at 8192 chars).
|
||||
(Michael Voříšek)
|
||||
|
||||
- PGSQL:
|
||||
. Fix GH-10672 (pg_lo_open segfaults in the strict_types mode). (girgias)
|
||||
|
||||
- Phar:
|
||||
. Fix incorrect check in phar tar parsing. (nielsdos)
|
||||
|
||||
|
@ -2464,7 +2464,7 @@ PHP_FUNCTION(pg_lo_open)
|
||||
CHECK_PGSQL_LINK(link);
|
||||
}
|
||||
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
|
||||
"Ols", &pgsql_link, pgsql_link_ce, &oid_long, &mode) == SUCCESS) {
|
||||
"OlS", &pgsql_link, pgsql_link_ce, &oid_long, &mode) == SUCCESS) {
|
||||
if (oid_long <= (zend_long)InvalidOid) {
|
||||
zend_value_error("Invalid OID value passed");
|
||||
RETURN_THROWS();
|
||||
|
39
ext/pgsql/tests/gh10672.phpt
Normal file
39
ext/pgsql/tests/gh10672.phpt
Normal file
@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
GH-10672 (pg_lo_open segfaults in the strict_types mode)
|
||||
--EXTENSIONS--
|
||||
pgsql
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include("skipif.inc");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
include "config.inc";
|
||||
|
||||
$db = pg_connect($conn_str);
|
||||
pg_query($db, "DROP TABLE IF EXISTS gh10672");
|
||||
pg_query($db, "CREATE TABLE gh10672 (bar text);");
|
||||
|
||||
// Begin a transaction
|
||||
pg_query($db, 'BEGIN');
|
||||
|
||||
// Create an empty large object
|
||||
$oid = pg_lo_create($db);
|
||||
|
||||
if ($oid === false) {
|
||||
die(pg_last_error($db));
|
||||
}
|
||||
|
||||
// Open the large object for writing
|
||||
$lob = pg_lo_open($db, $oid, 'w');
|
||||
|
||||
if ($oid === false) {
|
||||
die(pg_last_error($db));
|
||||
}
|
||||
|
||||
echo 'The large object has been opened successfully.', PHP_EOL;
|
||||
?>
|
||||
--EXPECT--
|
||||
The large object has been opened successfully.
|
Loading…
Reference in New Issue
Block a user