Skip to content

Instantly share code, notes, and snippets.

@laruence
Last active Aug 29, 2015
Embed
What would you like to do?
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index c3d8990..dbf5c50 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -480,13 +480,8 @@ static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_e
if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
*should_free = NULL;
ret = Z_INDIRECT_P(ret);
- } else if (!Z_REFCOUNTED_P(ret)) {
- *should_free = ret; /* immutable array may be converted to regular */
- } else if (Z_REFCOUNT_P(ret) == 1) {
- *should_free = ret;
} else {
- *should_free = NULL;
- Z_DELREF_P(ret);
+ *should_free = ret; /* immutable array may be converted to regular */
}
return ret;
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 9ee27d8..eceed13 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -7250,11 +7250,11 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
- if (UNEXPECTED(Z_REFCOUNT_P(var_ptr) == 1)) {
- ZVAL_UNREF(var_ptr);
- }
- } else if (Z_COPYABLE_P(var_ptr) && Z_REFCOUNT_P(var_ptr) > 1) {
+ if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
+ !Z_ISREF_P(var_ptr) &&
+ Z_REFCOUNTED_P(var_ptr) &&
+ Z_REFCOUNT_P(var_ptr) > 1) {
+
Z_DELREF_P(var_ptr);
ZVAL_DUP(EX_VAR(opline->op1.var), var_ptr);
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 8dd8881..cf1c7a1 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -19444,11 +19444,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDL
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (UNEXPECTED(Z_ISREF_P(var_ptr))) {
- if (UNEXPECTED(Z_REFCOUNT_P(var_ptr) == 1)) {
- ZVAL_UNREF(var_ptr);
- }
- } else if (Z_COPYABLE_P(var_ptr) && Z_REFCOUNT_P(var_ptr) > 1) {
+ if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
+ !Z_ISREF_P(var_ptr) &&
+ Z_REFCOUNTED_P(var_ptr) &&
+ Z_REFCOUNT_P(var_ptr) > 1) {
+
Z_DELREF_P(var_ptr);
ZVAL_DUP(EX_VAR(opline->op1.var), var_ptr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment