Re: problem in parseDSN
| From: | Colin Viebrock | Date: | Wed, 18 Apr 2001 14:24:59 +0000 |
| Subject: | Re: problem in parseDSN | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-254@lists.php.net to get a copy of this message | ||
> > - if (preg_match('|^([^(]+)\(([^(]*)\)$|', $str, $arr)) {
> > + if (preg_match('|^([^(]+)\(([^)]*)\)$|', $str, $arr)) {
> > Or maybe even the shorter:
> > + if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
>
> Colin,
>
> Could you supply a DSN that breaks?
Well, the only ones I can think of are probably malformed:
mysql(ab(de)://username:password@db
My point is that the regex to pull out the dbsyntax portion of the DSN
is looking for every non-"(" character before a ")", whereas I think it
should be every non-")" before a ")". Just a simple typo, I think.
- Colin
P.S. Also, this DSN fails:
mysql://user:pass
I suppose some people may want to connect to MySQL, for instance, without
specifying a database right away ...