diff options
Diffstat (limited to 'ext/pdo/pdo_stmt.c')
| -rw-r--r-- | ext/pdo/pdo_stmt.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 6019c39aba..c2f3c13399 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -740,9 +740,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */ } if (ce->constructor) { - fci->function_table = &ce->function_table; ZVAL_UNDEF(&fci->function_name); - fci->symbol_table = NULL; fci->retval = &stmt->fetch.cls.retval; fci->param_count = 0; fci->params = NULL; @@ -752,7 +750,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */ fcc->initialized = 1; fcc->function_handler = ce->constructor; - fcc->calling_scope = EG(scope); + fcc->calling_scope = zend_get_executed_scope(); fcc->called_scope = ce; return 1; } else if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args)) { @@ -1241,7 +1239,6 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, int fetch_all) return 0; } /* fall through */ - default: if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can only be used together with PDO::FETCH_CLASS"); @@ -1542,16 +1539,16 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, { struct pdo_bound_param_data param = {{{0}}}; zend_long param_type = PDO_PARAM_STR; - zval *parameter; + zval *parameter, *driver_params = NULL; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz|llz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, - ¶m.driver_params)) { + &driver_params)) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|llz!", ¶m.name, ¶meter, ¶m_type, ¶m.max_value_len, - ¶m.driver_params)) { + &driver_params)) { return 0; } } @@ -1565,6 +1562,10 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, return 0; } + if (driver_params) { + ZVAL_COPY(¶m.driver_params, driver_params); + } + ZVAL_COPY(¶m.parameter, parameter); if (!really_register_bound_param(¶m, stmt, is_param)) { if (!Z_ISUNDEF(param.parameter)) { @@ -2215,6 +2216,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str lc_method_name = zend_string_alloc(ZSTR_LEN(method_name), 0); zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name)); + if ((fbc = zend_hash_find_ptr(&object->ce->function_table, lc_method_name)) == NULL) { pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object); /* instance not created by PDO object */ @@ -2239,6 +2241,9 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str out: zend_string_release(lc_method_name); + if (!fbc) { + fbc = std_object_handlers.get_method(object_pp, method_name, key); + } return fbc; } @@ -2619,6 +2624,7 @@ static union _zend_function *row_method_get( } zend_string_release(lc_method_name); + return fbc; } |
