From: Dmitry Stogov Date: Wed, 20 Aug 2014 19:28:32 +0000 (+0400) Subject: Fixed ext/pdo_*/tests/pdo_005.phpt tests failure X-Git-Tag: PRE_64BIT_BRANCH_MERGE~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cda420ff4af5fc96d9784dfd203711dec4bfc54;p=php Fixed ext/pdo_*/tests/pdo_005.phpt tests failure --- diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 9881740c06..990a1dc79f 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3484,9 +3484,10 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count } /* }}} */ -ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* {{{ */ +ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args TSRMLS_DC) /* {{{ */ { zval *arg, *params; + int n = 1; zend_fcall_info_args_clear(fci, !args); @@ -3502,14 +3503,28 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* fci->params = params = (zval *) erealloc(fci->params, fci->param_count * sizeof(zval)); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args), arg) { - ZVAL_COPY(params, arg); + if (func && !Z_ISREF_P(arg) && ARG_SHOULD_BE_SENT_BY_REF(func, n)) { + ZVAL_NEW_REF(params, arg); + if (Z_REFCOUNTED_P(arg)) { + Z_ADDREF_P(arg); + } + } else { + ZVAL_COPY(params, arg); + } params++; + n++; } ZEND_HASH_FOREACH_END(); return SUCCESS; } /* }}} */ +ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* {{{ */ +{ + return zend_fcall_info_args_ex(fci, NULL, args TSRMLS_CC); +} +/* }}} */ + ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval *argv) /* {{{ */ { int i; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 0268374fc4..0fceb42a44 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -491,6 +491,7 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count * refcount. If args is NULL and arguments are set then those are cleared. */ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC); +ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args TSRMLS_DC); /** Set arguments in the zend_fcall_info struct taking care of refcount. * If argc is 0 the arguments which are set will be cleared, else pass diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index c4ae2f6fe1..96407c3127 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -748,7 +748,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ fci->params = NULL; fci->no_separation = 1; - zend_fcall_info_args(fci, &stmt->fetch.cls.ctor_args TSRMLS_CC); + zend_fcall_info_args_ex(fci, ce->constructor, &stmt->fetch.cls.ctor_args TSRMLS_CC); fcc->initialized = 1; fcc->function_handler = ce->constructor;