Bug #68393 [Opn]: PDO Does Not Produce Exception For 'sqlite:' With Missing Filepath

From: Date: Mon, 10 Nov 2014 22:38:02 +0000
Subject: Bug #68393 [Opn]: PDO Does Not Produce Exception For 'sqlite:' With Missing Filepath
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188544@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68393&edit=1

 ID:                 68393
 Updated by:         salathe@php.net
 Reported by:        kyra at existing dot me
 Summary:            PDO Does Not Produce Exception For 'sqlite:' With
                     Missing Filepath
 Status:             Open
 Type:               Bug
 Package:            PDO SQLite
 Operating System:   Linux
 PHP Version:        5.6.2
 Block user comment: N
 Private report:     N

 New Comment:

From SQLite's point of view, this looks to be okay.

Here's a snippet from the SQLite docs[1], in the "Opening
A New Database Connection" section[2]:

  If the filename is an empty string, then a private,
  temporary on-disk database will be created. This 
  private database will be automatically deleted as 
  soon as the database connection is closed.

[1] http://www.sqlite.org/c3ref/intro.html
[2] http://www.sqlite.org/c3ref/open.html


Previous Comments:
------------------------------------------------------------------------
[2014-11-10 21:59:09] kyra at existing dot me

Description:
------------
I was passing the SQLite filepath portion of the DSN as a variable and happened to pass an empty
string, but PDO did not raise an Exception, and gave no indication the connection had failed.

If you check out http://3v4l.org/o1k3M you can see at some point
after PHP 5.2.14 that this behavior began.

Test script:
---------------
$db = new PDO('sqlite:');

Expected result:
----------------
Fatal error: Uncaught exception 'PDOException' with message...



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68393&edit=1


Thread (3 messages)

« previous php.bugs (#188544) next »