Req #71150 [Fbk->NoF]: Calling SQLite3::enableExceptions returns previous value instead of new value
| From: | php-bugs at lists dot php dot net | Date: | Sun, 11 Sep 2016 04:22:36 +0000 |
| Subject: | Req #71150 [Fbk->NoF]: Calling SQLite3::enableExceptions returns previous value instead of new value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203959@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: php-bugs@lists.php.net
Reported by: bill at zeroedin dot com
Summary: Calling SQLite3::enableExceptions returns previous value
instead of new value
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: SQLite related
PHP Version: master-Git-2015-12-17 (Git)
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2016-09-02 19:20:30] cmb@php.net
After further consideration I don't think that changing the
behavior of SQLite3::enableException() is viable (at least not
without an explicit RFC) due to BC concerns.
Furthermore, getting the current state seems to be rarely needed,
and if one needs it, one could still write a function in userland:
<?php
function exceptions_enabled() {
$current = SQLite3::enableException();
SQLite3::enableException($current);
return $current;
}
------------------------------------------------------------------------
[2016-06-27 15:32:22] cmb@php.net
Indeed, this is not a bug, because $enable defaults to false, and
as such the method is not overloaded to work as getter and setter.
> The behavior should be changed to match other similar methods on
> other drivers.
Do other "drivers" work otherwise? Anyhow, I'm changing to
feature request.
------------------------------------------------------------------------
[2015-12-18 02:58:20] laruence@php.net
SQLite3::enableException($enable = false);
it returns previously value of enableexception, which default to false.
thanks
------------------------------------------------------------------------
[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