mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Fix error message allocation of PDO PgSQL
Closes GH-7723.
This commit is contained in:
parent
2c2b0abd4a
commit
778513f605
3
NEWS
3
NEWS
@ -7,6 +7,9 @@ PHP NEWS
|
||||
. Fixed bug #81585 (cached_chunks are not counted to real_size on shutdown).
|
||||
(cmb)
|
||||
|
||||
- PDO_PGSQL:
|
||||
. Fixed error message allocation of PDO PgSQL. (SATO Kentaro)
|
||||
|
||||
- Spl:
|
||||
. Fixed bug #75917 (SplFileObject::seek broken with CSV flags). (Aliaksandr
|
||||
Bystry)
|
||||
|
@ -87,7 +87,7 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
einfo->errmsg = estrdup(msg);
|
||||
einfo->errmsg = pestrdup(msg, dbh->is_persistent);
|
||||
}
|
||||
else if (errmsg) {
|
||||
einfo->errmsg = _pdo_pgsql_trim_message(errmsg, dbh->is_persistent);
|
||||
|
30
ext/pdo_pgsql/tests/gh7723.phpt
Normal file
30
ext/pdo_pgsql/tests/gh7723.phpt
Normal file
@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
GitHub #7723 (Fix error message allocation of PDO PgSQL)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
require __DIR__ . '/config.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||
require __DIR__ . '/config.inc';
|
||||
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
|
||||
$db->setAttribute(PDO::ATTR_PERSISTENT, true);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||
|
||||
$st = $db->prepare('select 1');
|
||||
for ($i = 0; ++$i <= 2;) {
|
||||
try {
|
||||
$st->bindValue(':invalid', $i);
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
SQLSTATE[HY093]: Invalid parameter number: :invalid
|
||||
SQLSTATE[HY093]: Invalid parameter number: :invalid
|
Loading…
Reference in New Issue
Block a user