mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.1'
* PHP-7.1: Fixed #73959 - lastInsertId fails to throw an exception in pdsql
This commit is contained in:
commit
0877839469
3 changed files with 31 additions and 1 deletions
4
NEWS
4
NEWS
|
@ -91,6 +91,10 @@ PHP NEWS
|
||||||
(Adam Baratz)
|
(Adam Baratz)
|
||||||
. Fixed bug #73396 (bigint columns are returned as strings). (Adam Baratz)
|
. Fixed bug #73396 (bigint columns are returned as strings). (Adam Baratz)
|
||||||
|
|
||||||
|
- PDO_PgSQL:
|
||||||
|
. Fixed bug #73959 (lastInsertId fails to throw an exception for wrong
|
||||||
|
sequence name). (andrewnester)
|
||||||
|
|
||||||
- posix:
|
- posix:
|
||||||
. Fixed bug #71219 (configure script incorrectly checks for ttyname_r). (atoh)
|
. Fixed bug #71219 (configure script incorrectly checks for ttyname_r). (atoh)
|
||||||
|
|
||||||
|
|
|
@ -379,7 +379,6 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *
|
||||||
*len = PQgetlength(res, 0, 0);
|
*len = PQgetlength(res, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
pdo_pgsql_error(dbh, status, pdo_pgsql_sqlstate(res));
|
pdo_pgsql_error(dbh, status, pdo_pgsql_sqlstate(res));
|
||||||
*len = spprintf(&id, 0, ZEND_LONG_FMT, (zend_long) H->pgoid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
27
ext/pdo_pgsql/tests/bug73959.phpt
Normal file
27
ext/pdo_pgsql/tests/bug73959.phpt
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #73959 (lastInsertId fails to throw an exception)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
require dirname(__FILE__) . '/config.inc';
|
||||||
|
PDOTest::skip();
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
require dirname(__FILE__) . '/config.inc';
|
||||||
|
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||||
|
$db->setAttribute(PDO::ATTR_PERSISTENT, false);
|
||||||
|
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$db->lastInsertId('nonexistent_seq');
|
||||||
|
echo "Error: No exception thrown";
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo "Success: Exception thrown";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Success: Exception thrown
|
Loading…
Add table
Add a link
Reference in a new issue