Bug #73959 [NEW]: lastInsertId fails to throw an exception

From: Date: Thu, 19 Jan 2017 10:36:48 +0000
Subject: Bug #73959 [NEW]: lastInsertId fails to throw an exception
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206742@lists.php.net to get a copy of this message
From: david dot hedberg at zavann dot se Operating system: Ubuntu 16.04 PHP version: 7.0.14 Package: PDO PgSQL Bug Type: Bug Bug description:lastInsertId fails to throw an exception 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 bug report at https://bugs.php.net/bug.php?id=73959&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73959&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73959&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73959&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73959&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73959&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73959&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73959&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73959&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73959&r=support Expected behavior: https://bugs.php.net/fix.php?id=73959&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73959&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73959&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73959&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73959&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73959&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73959&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73959&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73959&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73959&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73959&r=mysqlcfg

« previous php.bugs (#206742) next »