Skip to content

Commit ea2c169

Browse files
committed
static_variables can no longer contain constant ast
1 parent 1a7975c commit ea2c169

File tree

5 files changed

+4
-30
lines changed

5 files changed

+4
-30
lines changed

Zend/Optimizer/dce.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,6 @@ static inline bool may_have_side_effects(
246246
if ((opline->extended_value & (ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT))) {
247247
return 1;
248248
}
249-
250-
if ((opline->extended_value & ZEND_BIND_REF) != 0) {
251-
zval *value =
252-
(zval*)((char*)op_array->static_variables->arData +
253-
(opline->extended_value & ~ZEND_BIND_REF));
254-
if (Z_TYPE_P(value) == IS_CONSTANT_AST) {
255-
/* AST may contain undefined constants */
256-
return 1;
257-
}
258-
}
259249
}
260250
return 0;
261251
case ZEND_CHECK_VAR:

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4744,7 +4744,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
47444744
return 1;
47454745
} else {
47464746
zval *value = (zval*)((char*)op_array->static_variables->arData + (opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT|ZEND_BIND_EXPLICIT)));
4747-
/* May throw if initializer is CONSTANT_AST. */
4747+
/* Destructor of overwritten local variable may throw. */
47484748
return Z_TYPE_P(value) == IS_CONSTANT_AST;
47494749
}
47504750
case ZEND_ASSIGN_DIM:

Zend/zend_closures.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,14 +593,10 @@ static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp)
593593
ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(static_variables, key, var) {
594594
zval copy;
595595

596-
if (Z_TYPE_P(var) == IS_CONSTANT_AST) {
597-
ZVAL_STRING(&copy, "<constant ast>");
598-
} else {
599-
if (Z_ISREF_P(var) && Z_REFCOUNT_P(var) == 1) {
600-
var = Z_REFVAL_P(var);
601-
}
602-
ZVAL_COPY(&copy, var);
596+
if (Z_ISREF_P(var) && Z_REFCOUNT_P(var) == 1) {
597+
var = Z_REFVAL_P(var);
603598
}
599+
ZVAL_COPY(&copy, var);
604600

605601
zend_hash_add_new(Z_ARRVAL(val), key, &copy);
606602
} ZEND_HASH_FOREACH_END();

Zend/zend_vm_def.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8863,12 +8863,6 @@ ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
88638863

88648864
SAVE_OPLINE();
88658865
if (opline->extended_value & ZEND_BIND_REF) {
8866-
if (Z_TYPE_P(value) == IS_CONSTANT_AST) {
8867-
if (UNEXPECTED(zval_update_constant_ex(value, EX(func)->op_array.scope) != SUCCESS)) {
8868-
HANDLE_EXCEPTION();
8869-
}
8870-
}
8871-
88728866
i_zval_ptr_dtor(variable_ptr);
88738867
if (UNEXPECTED(!Z_ISREF_P(value))) {
88748868
zend_reference *ref = (zend_reference*)emalloc(sizeof(zend_reference));

Zend/zend_vm_execute.h

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)