Bug #73959 [Com]: lastInsertId fails to throw an exception
| From: | david dot hedberg at zavann dot se | Date: | Sat, 21 Jan 2017 09:09:48 +0000 |
| Subject: | Bug #73959 [Com]: lastInsertId fails to throw an exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206814@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73959&edit=1
ID: 73959
Comment by: david dot hedberg at zavann dot se
Reported by: david dot hedberg at zavann dot se
Summary: lastInsertId fails to throw an exception
Status: Closed
Type: Bug
Package: PDO PgSQL
Operating System: Ubuntu 16.04
PHP Version: 7.0.14
Block user comment: N
Private report: N
New Comment:
Thanks!
Previous Comments:
------------------------------------------------------------------------
[2017-01-20 20:12:42] krakjoe@php.net
Automatic comment on behalf of andrew.nester.dev@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=21ac79e94bd0335bf885b807e09c4d86d75d776a
Log: Fixed #73959 - lastInsertId fails to throw an exception in pdsql
------------------------------------------------------------------------
[2017-01-20 15:02:39] andrew dot nester dot dev at gmail dot com
I've just added PR to fix this problem. Please review it on GitHub.
------------------------------------------------------------------------
[2017-01-19 10:36:42] david dot hedberg at zavann dot se
Description:
------------
Running PDO::lastInsertId() using a bad sequence name (not updated or nonexistent) no longer throws
an exception after upgrading.
PostgreSQL server version is 9.5.5.
It works in 7.0.8-0ubuntu0.16.04.3, but fails in both 7.0.13-0ubuntu0.16.04.1 and
7.0.14-2+deb.sury.org~xenial+1.
Test script:
---------------
$pdo = new PDO(
'pgsql:service=...', null, null,
array(
PDO::ATTR_PERSISTENT => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::PGSQL_ATTR_DISABLE_PREPARES => true
)
);
try {
$pdo->lastInsertId('nonexistent_seq');
echo "Error: No exception thrown";
} catch (PDOException $e) {
echo "Success: Exception thrown";
}
Expected result:
----------------
Success: Exception thrown
Actual result:
--------------
Error: No exception thrown
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73959&edit=1