summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xext/pdo/pdo_stmt.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 7518cc23d7..aaa3a71f89 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -713,20 +713,32 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
zend_update_property(ce, return_value,
stmt->columns[i].name, stmt->columns[i].namelen,
val TSRMLS_CC);
- if (ce->constructor) {
- stmt->fetch.cls.fci.object_pp = &return_value;
- stmt->fetch.cls.fcc.object_pp = &return_value;
- if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(pdo_exception_ce, 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
- } else {
- if (stmt->fetch.cls.retval_ptr) {
- zval_ptr_dtor(&stmt->fetch.cls.retval_ptr);
- }
- }
- }
+ break;
+
+ default:
+ pdo_raise_impl_error(stmt->dbh, stmt, "22003", "mode is out of range" TSRMLS_CC);
break;
}
}
+
+ switch (how) {
+ case PDO_FETCH_CLASS:
+ if (ce->constructor) {
+ stmt->fetch.cls.fci.object_pp = &return_value;
+ stmt->fetch.cls.fcc.object_pp = &return_value;
+ if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
+ zend_throw_exception_ex(pdo_exception_ce, 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
+ } else {
+ if (stmt->fetch.cls.retval_ptr) {
+ zval_ptr_dtor(&stmt->fetch.cls.retval_ptr);
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
}
return 1;