Browse Source

- Only call the ctor once

PHP-5.1
Marcus Boerger 22 years ago
parent
commit
3239a56526
  1. 34
      ext/pdo/pdo_stmt.c

34
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;

Loading…
Cancel
Save