Home » Database » DB » Bug #693
Undefined index in mysql.php
Details
| Submitted | 2004-02-06 07:10 UTC |
|---|---|
| From | pear at humbapa dot ch |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | Irrelevant |
| OS | * |
| Roadmaps | (Not assigned) |
Comments
[2004-02-06 07:10 UTC] pear at humbapa dot ch
Description:
------------
I got the following error:
Notice: Undefined index: port in /usr/local/apache2/lib/php/DB/mysql.php on line 123
I use mysql with sockets so there is no port defined when I try to connect.
when I change the line 123 from:
if ($dsninfo['port']) {
to:
if (!empty($dsninfo['port'])) {
everything works as expected
I know that this is not a bug, but it would be nice to have no "Notices" from the DB-package
thanks :-)
martin luethi
[2004-02-06 09:27 UTC] tuupola at php dot net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PEAR.
Can you provide a DSN which produces the error. Atleast I can't reproduce it with simple mysql://root:@unix(/tmp/mysql.sock)/test
[2004-02-06 10:41 UTC] pear at humbapa dot ch
--- code ------------
<?php
error_reporting(E_ALL);
include("DB.php");
$dsn = array(
"phptype" => "mysql",
"protocol" => "tcp",
"hostspec" => "localhost",
"username" => "user",
"password" => "******",
"database" => "db"
);
$db = &DB::connect($dsn);
?>
---------------------
--- result ----------
Notice: Undefined index: port in /usr/local/apache2/lib/php/DB/mysql.php
on line 123
---------------------