Bug #71150 [Opn]: Calling SQLite3::enableExceptions returns previous value instead of new value
| From: | laruence@php.net | Date: | Fri, 18 Dec 2015 02:58:20 +0000 |
| Subject: | Bug #71150 [Opn]: Calling SQLite3::enableExceptions returns previous value instead of new value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-197984@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71150&edit=1
ID: 71150
Updated by: laruence@php.net
Reported by: bill at zeroedin dot com
Summary: Calling SQLite3::enableExceptions returns previous
value instead of new value
Status: Open
Type: Bug
Package: SQLite related
PHP Version: master-Git-2015-12-17 (Git)
Block user comment: N
Private report: N
New Comment:
SQLite3::enableException($enable = false);
it returns previously value of enableexception, which default to false.
thanks
Previous Comments:
------------------------------------------------------------------------
[2015-12-17 16:30:10] bill at zeroedin dot com
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 this bug report at https://bugs.php.net/bug.php?id=71150&edit=1