]> granicus.if.org Git - php/commitdiff
Fixed ext/pdo_*/tests/pdo_005.phpt tests failure
authorDmitry Stogov <dmitry@zend.com>
Wed, 20 Aug 2014 19:28:32 +0000 (23:28 +0400)
committerDmitry Stogov <dmitry@zend.com>
Wed, 20 Aug 2014 19:28:32 +0000 (23:28 +0400)
Zend/zend_API.c
Zend/zend_API.h
ext/pdo/pdo_stmt.c

index 9881740c06fdc63de929b54b6d024ccb8c32ffdc..990a1dc79f60cc9929bef32cffef9f92d7fc8fed 100644 (file)
@@ -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;
index 0268374fc4d83c75e9e6556cf7ae5763b63f939d..0fceb42a4459351ce7b8ca1f794f20fb068ebacb 100644 (file)
@@ -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
index c4ae2f6fe13b9b42a418d68e243702bad9396b93..96407c31273eb3be8d10098f9a989b0c648b9bb5 100644 (file)
@@ -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;