Closes PECL Bug #5750; uri: dsn is not handled correctly.

Patch from curt@php.net
This commit is contained in:
Wez Furlong 2005-10-23 04:10:20 +00:00
parent ecca329c14
commit ea544cf38f

View file

@ -252,7 +252,7 @@ static PHP_METHOD(PDO, dbh_constructor)
if (!strncmp(data_source, "uri:", sizeof("uri:")-1)) { if (!strncmp(data_source, "uri:", sizeof("uri:")-1)) {
/* the specified URI holds connection details */ /* the specified URI holds connection details */
data_source = dsn_from_uri(data_source, alt_dsn, sizeof(alt_dsn) TSRMLS_CC); data_source = dsn_from_uri(data_source + sizeof("uri:")-1, alt_dsn, sizeof(alt_dsn) TSRMLS_CC);
if (!data_source) { if (!data_source) {
zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source URI"); zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source URI");
ZVAL_NULL(object); ZVAL_NULL(object);