Bug #71150 [NEW]: Calling SQLite3::enableExceptions returns previous value instead of new value
| From: | bill at zeroedin dot com | Date: | Thu, 17 Dec 2015 16:30:13 +0000 |
| Subject: | Bug #71150 [NEW]: Calling SQLite3::enableExceptions returns previous value instead of new value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197970@lists.php.net to get a copy of this message | ||
From: bill at zeroedin dot com
Operating system:
PHP version: master-Git-2015-12-17 (Git)
Package: SQLite related
Bug Type: Bug
Bug description:Calling SQLite3::enableExceptions returns previous value instead of new value
Description:
------------
I am documenting the previously undocumented method
SQLite3::enableExceptions, and I notice that the method has some weird
behavior.
Currently, if you call enableExceptions(true) and exceptions were
previously disabled, it returns false. The inverse is also true.
If you call enableExceptions(), it turns off exceptions for the driver
and returns whatever value was previously set.
The behavior should be changed to match other similar methods on other
drivers.
The method should only change the exception behavior if the
$enableExceptions parameter is true or false passed by the user. If no
value is passed, the method should return the current state of the flag
and take no action. When $enableExceptions is passed by the user, the
method should set the value and then return the new value.
Test script:
---------------
$sqlite3 = new SQLite3(':memory:');
var_dump($sqlite3->enableExceptions(true));
var_dump($sqlite3->enableExceptions());
var_dump($sqlite3->enableExceptions());
var_dump($sqlite3->enableExceptions(false));
var_dump($sqlite3->enableExceptions());
var_dump($sqlite3->enableExceptions());
Expected result:
----------------
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
Actual result:
--------------
bool(false)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=71150&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71150&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71150&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71150&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71150&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71150&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71150&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71150&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71150&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71150&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71150&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71150&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71150&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71150&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71150&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71150&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71150&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71150&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71150&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71150&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71150&r=mysqlcfg