summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_compile.c2
-rw-r--r--Zend/zend_execute_API.c15
-rw-r--r--Zend/zend_vm_def.h7
-rw-r--r--Zend/zend_vm_execute.h7
-rw-r--r--ext/pdo/pdo_stmt.c7
-rw-r--r--ext/pdo/php_pdo_driver.h9
6 files changed, 38 insertions, 9 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 65cbbc9709..de62e9c439 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4240,7 +4240,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
cur_method_ref = cur_precedence->trait_method;
if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name,
ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name);
+ zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
}
zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index ff52993ca0..3806af0a05 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -885,7 +885,22 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zval *param;
if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i + 1)) {
+ // TODO: Scalar values don't have reference counters anymore.
+ // They are assumed to be 1, and they may be easily passed by
+ // reference now. However, previously scalars with refcount==1
+ // might be passed and with refcount>1 might not. We can support
+ // only single behavior ???
+#if 0
+ if (Z_REFCOUNTED(fci->params[i]) &&
+ // This solution breaks the following test (omit warning message) ???
+ // Zend/tests/bug61273.phpt
+ // ext/reflection/tests/bug42976.phpt
+ // ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
+#else
if (!Z_REFCOUNTED(fci->params[i]) ||
+ // This solution breaks the following test (emit warning message) ???
+ // ext/pdo_sqlite/tests/pdo_005.phpt
+#endif
(!Z_ISREF(fci->params[i]) && Z_REFCOUNT(fci->params[i]) > 1)) {
if (fci->no_separation &&
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 2538e86cd8..c0d88eaa66 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1938,8 +1938,13 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
if (fbc->common.scope) {
should_change_scope = 1;
Z_OBJ(EG(This)) = object;
-//??? EG(scope) = (object) ? NULL : fbc->common.scope;
+ /* TODO: we don't set scope if we call an object method ??? */
+ /* See: ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt */
+#if 1
+ EG(scope) = (object) ? NULL : fbc->common.scope;
+#else
EG(scope) = fbc->common.scope;
+#endif
EG(called_scope) = EX(call)->called_scope;
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 6abc07d4e5..da7c59a56e 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -548,8 +548,13 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
if (fbc->common.scope) {
should_change_scope = 1;
Z_OBJ(EG(This)) = object;
-//??? EG(scope) = (object) ? NULL : fbc->common.scope;
+ /* TODO: we don't set scope if we call an object method ??? */
+ /* See: ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt */
+#if 1
+ EG(scope) = (object) ? NULL : fbc->common.scope;
+#else
EG(scope) = fbc->common.scope;
+#endif
EG(called_scope) = EX(call)->called_scope;
}
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 45d73fb669..a0a3a8b5fc 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -811,7 +811,12 @@ static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs TSRMLS_DC) /
{
/* fci.size is used to check if it is valid */
if (stmt->fetch.cls.fci.size && stmt->fetch.cls.fci.params) {
- efree(stmt->fetch.cls.fci.params);
+ if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args)) {
+ /* Added to free constructor arguments ??? */
+ zend_fcall_info_args_clear(&stmt->fetch.cls.fci, 1);
+ } else {
+ efree(stmt->fetch.cls.fci.params);
+ }
stmt->fetch.cls.fci.params = NULL;
}
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index 6a0faaa121..0326eaa5a1 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -605,19 +605,18 @@ struct _pdo_stmt_t {
union {
int column;
struct {
- zend_class_entry *ce;
- void *_reserved;
zval ctor_args; /* freed */
- zval retval;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
+ zval retval;
+ zend_class_entry *ce;
} cls;
struct {
- zval function;
zval fetch_args; /* freed */
- zval object;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
+ zval object;
+ zval function;
zval *values; /* freed */
} func;
zval into;