Bug #73141 [Opn->Nab]: i am running php-Pear project. and error to providing password in dsn .

From: Date: Thu, 22 Sep 2016 08:42:15 +0000
Subject: Bug #73141 [Opn->Nab]: i am running php-Pear project. and error to providing password in dsn .
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204180@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73141&edit=1 ID: 73141 Updated by: cmb@php.net Reported by: waqasrana11 at gmail dot com Summary: i am running php-Pear project. and error to providing password in dsn . -Status: Open +Status: Not a bug Type: Bug Package: MySQL related Operating System: windows 10 PHP Version: 5.6.26 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This doesn't appear to be a general PHP issue, but rather a PEAR/DB specific one, so please report this at <http://pear.php.net/bugs/>. Previous Comments: ------------------------------------------------------------------------ [2016-09-22 06:14:31] waqasrana11 at gmail dot com Description: ------------ require_once 'DB.php'; $dsn = 'mysql://root:@localhost/web_cms'; $options = array( 'debug' => 2, 'portability' => DB_PORTABILITY_ALL, ); $dbh =& DB::connect($dsn, $options); if (DB::isError($dbh)) { die($dbh->getMessage()); } function connect($dsninfo, $persistent = false) { $db = new DB(); if (!($db->assertExtension('mysql'))) { return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); } $this->dsn = $dsninfo; if ($dsninfo['protocol'] && $dsninfo['protocol'] == 'unix') { $dbhost = ':' . $dsninfo['socket']; } else { $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; if ($dsninfo['port']) { $dbhost .= ':' . $dsninfo['port']; } } $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect'; if ($dbhost && $dsninfo['username'] && isset($dsninfo['password'])) { $conn = @$connect_function($dbhost, $dsninfo['username'], // error in the following line $dsninfo['password']); } elseif ($dbhost && $dsninfo['username']) { $conn = @$connect_function($dbhost, $dsninfo['username']); } elseif ($dbhost) { $conn = @$connect_function($dbhost); } else { $conn = false; } Test script: --------------- Fatal error in line 132 of fileC:\xampp\htdocs\cms-includes\pear\DB\mysql.php - mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead this lin # 132 $dsninfo['password']); so my db credentials are db --> 'web_cms' username-> 'root' password --> ' ' hots --> localhost so how can i provide blank or no password in dsn = mysql//:user:pass@host/db Expected result: ---------------- just remove this error and should display result ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73141&edit=1

« previous php.bugs (#204180) next »