]> granicus.if.org Git - php/commitdiff
Search for the '@' symbol in the DSN from the right instead of the left.
authorJon Parise <jon@php.net>
Thu, 4 Oct 2001 00:29:37 +0000 (00:29 +0000)
committerJon Parise <jon@php.net>
Thu, 4 Oct 2001 00:29:37 +0000 (00:29 +0000)
That will allow the password element to include a '@' symbol without
confusing the DSN parser.

Submitted by: Alex L <admin@networkessence.net>

pear/DB.php

index 1710f3997fe5a1e8ef77b436ca3de81f8177769e..e0e4789bf994b475369a5120ac2b01e1c6493521 100644 (file)
@@ -459,7 +459,7 @@ class DB
 
         // Get (if found): username and password
         // $dsn => username:password@protocol+hostspec/database
-        if (($at = strpos($dsn,'@')) !== false) {
+        if (($at = strrpos($dsn,'@')) !== false) {
             $str = substr($dsn, 0, $at);
             $dsn = substr($dsn, $at + 1);
             if (($pos = strpos($str, ':')) !== false) {
@@ -722,4 +722,4 @@ class DB_row
     }
 }
 
-?>
\ No newline at end of file
+?>