Skip to content

Commit d3267d0

Browse files
committedMar 15, 2015
Fixed PDO constructor to not return null.
1 parent 78ebf83 commit d3267d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎ext/pdo/pdo_dbh.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,15 @@ static PHP_METHOD(PDO, dbh_constructor)
208208
zval *options = NULL;
209209
char alt_dsn[512];
210210
int call_factory = 1;
211+
zend_error_handling zeh;
212+
int rv;
211213

212-
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!a!", &data_source, &data_source_len,
213-
&username, &usernamelen, &password, &passwordlen, &options)) {
214+
zend_replace_error_handling(EH_THROW, pdo_exception_ce, &zeh TSRMLS_CC);
215+
rv = zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!a!", &data_source, &data_source_len,
216+
&username, &usernamelen, &password, &passwordlen, &options);
217+
zend_restore_error_handling(&zeh TSRMLS_CC);
218+
219+
if (FAILURE == rv) {
214220
ZEND_CTOR_MAKE_NULL();
215221
return;
216222
}

0 commit comments

Comments
 (0)
Please sign in to comment.