Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitry Stogov dstogov

  • Zend by Perforce
  • Russia
View GitHub Profile
View ce_cache.diff
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 6f7fef32a0..151afadec2 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -726,10 +726,25 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
/* Fast class cache */
#define ZSTR_HAS_CE_CACHE(s) (GC_FLAGS(s) & IS_STR_CLASS_NAME_MAP_PTR)
-#define ZSTR_GET_CE_CACHE(s) \
- (*(zend_class_entry **)ZEND_MAP_PTR_OFFSET2PTR(GC_REFCOUNT(s)))
View interrupt.diff
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 9979a9b2fb..a98a3480d3 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -9857,6 +9857,20 @@ ZEND_VM_HELPER(zend_interrupt_helper, ANY, ANY)
zend_timeout();
} else if (zend_interrupt_function) {
zend_interrupt_function(execute_data);
+ if (EG(exception)) {
+ /* We have to UNDEF result, because ZEND_HANDLE_EXCEPTION is going to free it */
View fix.diff
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index a2cc930b2f..bbab942b96 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -4578,7 +4578,9 @@ finish:
static size_t preload_ub_write(const char *str, size_t str_length)
{
- return fwrite(str, 1, str_length, stdout);
+ size_t ret = fwrite(str, 1, str_length, stdout);
View test.php
<?php
class A {
public $prop = "x";
function foo() {
var_dump("A");
return $this->prop;
}
function bar() {
$x = $this->foo();
var_dump(str_repeat($x,5));
View fix.diff
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 40efcef2b9..9d15aadcf5 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -9866,7 +9866,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
}
}
- if (!trace && op_array == &func->op_array
+ if (GCC_GLOBAL_REGS && !trace && op_array == &func->op_array
View undef_val_fix.diff
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 175e063639..0447858e48 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -6018,6 +6018,27 @@ static int zend_jit_assign_to_variable_call(dasm_State **Dst,
zend_jit_addr __res_addr,
bool __check_exception)
{
+ if (val_info & MAY_BE_UNDEF) {
+ if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
View bool_not_leak_fix.diff
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 205d1bccb8..1c94e1a8e1 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -8271,7 +8271,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
return 1;
}
- if (op1_info & MAY_BE_REF) {
+ if (opline->op1_type == IS_CV && (op1_info & MAY_BE_REF)) {
View call_chain.diff
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
index 93c79bdce2..eceeed2733 100644
--- a/ext/opcache/jit/zend_jit.c
+++ b/ext/opcache/jit/zend_jit.c
@@ -292,7 +292,7 @@ static int zend_jit_is_constant_cmp_long_long(const zend_op *opline,
return 0;
}
-static int zend_jit_needs_call_chain(zend_call_info *call_info, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, const zend_ssa_op *ssa_op, const zend_op *opline, zend_jit_trace_rec *trace)
+static int zend_jit_needs_call_chain(zend_call_info *call_info, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, const zend_ssa_op *ssa_op, const zend_op *opline, int call_level, zend_jit_trace_rec *trace)
View fix.diff
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 7941b396f5..8e81627007 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -4831,7 +4831,11 @@ static int zend_jit_math_helper(dasm_State **Dst,
| FREE_OP op1_type, op1, op1_info, 0, opline
| FREE_OP op2_type, op2, op2_info, 0, opline
if (may_throw) {
- zend_jit_check_exception(Dst);
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
View map_ptr_fix.diff
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index d388e8184a..d089677287 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -478,6 +478,7 @@ static void zend_closure_free_storage(zend_object *object) /* {{{ */
/* We don't own the static variables of fake closures. */
if (!(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) {
zend_destroy_static_vars(&closure->func.op_array);
+ closure->func.op_array.static_variables = NULL;
}