From: Andrei Zmievski <andrei@php.net>
Date: Tue, 7 Dec 1999 21:30:38 +0000 (+0000)
Subject: (DB::parseDSN) Remove extraneous / at the end of the spec if no database
X-Git-Tag: RETURN_REF_BP~53
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c89f731e8802fcb3b42a87dfb214ac42f654bae;p=php

(DB::parseDSN) Remove extraneous / at the end of the spec if no database
               is specified.
---

diff --git a/pear/DB.php b/pear/DB.php
index 9585be30ed..52c50c7919 100644
--- a/pear/DB.php
+++ b/pear/DB.php
@@ -225,6 +225,9 @@ class DB {
 			$dsn = $arr[2];
 		}
 
+		if (!$parsed['database'])
+			$dsn = preg_replace('|/+$|', '', $dsn);
+
 		$parsed['hostspec'] = $dsn;
 
 		if (!$parsed['dbsyntax']) {