PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #6832

no error messages if db name is not specified in dsn

Details

Submitted2006-02-18 23:52 UTC
Frombrammeleman at brammeleman dot org
Assigneddanielc
StatusBogus
PackageDB
PHP Version5.0.4
OSMac OS X 10.4.5
Roadmaps(Not assigned)

Comments

[2006-02-18 23:52 UTC] brammeleman at brammeleman dot org

Description:
------------
When I forget to specify a db name in the dsn, I get no error
messages when trying to insert data into a table.

Test script:
---------------
require_once 'DB.php';

// note: no db specified in dsn
$dsn="mysql://dbuser@localhost";
$db =& DB::connect($dsn);
if(PEAR::isError($db)) {
die('failed to connect to db');
}

$sth = $db->prepare('INSERT INTO tablename (data) VALUES (?)');
$data = "test";
$db->execute($sth, $data);

if(PEAR::isError($db)) {
die('failed to insert data');
}

Expected result:
----------------
failed to insert data

Actual result:
--------------
no output and no records inserted