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

From: Date: Thu, 22 Sep 2016 06:14:36 +0000
Subject: Bug #73141 [NEW]: i am running php-Pear project. and error to providing password in dsn .
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204177@lists.php.net to get a copy of this message
From: waqasrana11 at gmail dot com Operating system: windows 10 PHP version: 5.6.26 Package: MySQL related Bug Type: Bug Bug description:i am running php-Pear project. and error to providing password in dsn . 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 bug report at https://bugs.php.net/bug.php?id=73141&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73141&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73141&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73141&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73141&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73141&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73141&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73141&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73141&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73141&r=support Expected behavior: https://bugs.php.net/fix.php?id=73141&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73141&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73141&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73141&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73141&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73141&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73141&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73141&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73141&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73141&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73141&r=mysqlcfg

« previous php.bugs (#204177) next »