php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47257 SQLite3->__construct has no sane way to detect errors
Submitted: 2009-01-31 19:22 UTC Modified: 2012-11-12 22:37 UTC
From: cellog@php.net Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.0beta1 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cellog@php.net
New email:
PHP Version: OS:

 

 [2009-01-31 19:22 UTC] cellog@php.net
Description:
------------
SQLite3->__construct does not indicate errors by anything other than an E_NOTICE.  This means we have to set a user error handler just to tell whether or not this code succeeds:

<?php
$a = new SQLite3('/path/to/database.sqlite');
?>

the constructor should throw an exception, or provide an error string parameter by reference like the SQLite object.

Reproduce code:
---------------
<?php
// run as non-root
$a = new SQLite3('/root/database.sqlite');
?>

Expected result:
----------------
exception

Actual result:
--------------
E_NOTICE error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-01 17:22 UTC] crrodriguez at suse dot de
Exceptions only IMHO, it is a "new" OOP only extension, kinda odd that it throws only notices on errors...
 [2009-02-01 17:51 UTC] scottmac@php.net
I'll add an error mode option and probably default it to an exception. I'm not a huge fan of heavy exception throwing code, you end up wrapping huge blocks of code in try {}.
 [2009-02-10 00:44 UTC] scottmac@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2009-02-10 01:07 UTC] cellog@php.net
the constructor throws exceptions (for the doc team)
 [2011-11-16 13:15 UTC] felipe@php.net
-Package: SQLite related +Package: Documentation problem
 [2012-10-02 23:33 UTC] niel dot archer at gmail dot com
Doc updated via PHP DOE. If accepted there is also a user note to remove when 
closing this.
 [2012-11-12 22:35 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=328340
Log: Adds mention of exception thrown if constructor fails. (doc #47257)

--
Provided by Niel Archer (niel.archer@gmail.com)
 [2012-11-12 22:37 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 [2012-11-12 22:37 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Committed Niel's patch, thank you very much. User note also deleted.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 20:01:32 2024 UTC