com php-src: Fixed ext/pdo_*/tests/pdo_005.phpt t ests failure: Zend/zend_API.c Zend/zend_API.h ext/pdo/pdo_stmt.c
| From: | Dmitry Stogov | Date: | Wed, 20 Aug 2014 19:28:32 +0000 |
| Subject: | com php-src: Fixed ext/pdo_*/tests/pdo_005.phpt t ests failure: Zend/zend_API.c Zend/zend_API.h ext/pdo/pdo_stmt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80649@lists.php.net to get a copy of this message | ||
Commit: 8cda420ff4af5fc96d9784dfd203711dec4bfc54
Author: Dmitry Stogov <dmitry@zend.com> Wed, 20 Aug 2014 23:28:32 +0400
Parents: cf09bc7825fc38a49b878beb9e73093aa0b7cf7e
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8cda420ff4af5fc96d9784dfd203711dec4bfc54
Log:
Fixed ext/pdo_*/tests/pdo_005.phpt tests failure
Changed paths:
M Zend/zend_API.c
M Zend/zend_API.h
M ext/pdo/pdo_stmt.c
Diff:
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 9881740..990a1dc 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 0268374...0fceb42 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 c4ae2f6..96407c3 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;