Skip to content

Commit b78f217

Browse files
Works now
1 parent d584681 commit b78f217

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_001.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
--TEST--
22
#[\Deprecated]: Using the value of a deprecated constant as the deprecation message.
3-
--XFAIL--
43
--FILE--
54
<?php
65

Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
--TEST--
22
#[\Deprecated]: Using the value of a deprecated constant as the deprecation message with a throwing error handler.
3-
--XFAIL--
43
--FILE--
54
<?php
65

Zend/zend_constants.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,11 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
477477
}
478478

479479
if (!(flags & ZEND_FETCH_CLASS_SILENT) && (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)) {
480-
zend_deprecated_constant(c, c->name);
480+
if (!CONST_IS_RECURSIVE(c)) {
481+
CONST_PROTECT_RECURSION(c);
482+
zend_deprecated_constant(c, c->name);
483+
CONST_UNPROTECT_RECURSION(c);
484+
}
481485
}
482486
return &c->value;
483487
}

Zend/zend_execute.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -5289,7 +5289,11 @@ static zend_always_inline zend_result _zend_quick_get_constant(
52895289
if (!check_defined_only) {
52905290
ZVAL_COPY_OR_DUP(EX_VAR(opline->result.var), &c->value);
52915291
if (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED) {
5292-
zend_deprecated_constant(c, c->name);
5292+
if (!CONST_IS_RECURSIVE(c)) {
5293+
CONST_PROTECT_RECURSION(c);
5294+
zend_deprecated_constant(c, c->name);
5295+
CONST_UNPROTECT_RECURSION(c);
5296+
}
52935297
return SUCCESS;
52945298
}
52955299
}

ext/opcache/jit/zend_jit_vm_helpers.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,13 @@ static zend_always_inline zend_constant* _zend_quick_get_constant(
333333

334334
if (!check_defined_only) {
335335
if (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED) {
336-
zend_deprecated_constant(c, c->name);
337-
if (EG(exception)) {
338-
return NULL;
336+
if (!CONST_IS_RECURSIVE(c)) {
337+
CONST_PROTECT_RECURSION(c);
338+
zend_deprecated_constant(c, c->name);
339+
CONST_PROTECT_RECURSION(c);
340+
if (EG(exception)) {
341+
return NULL;
342+
}
339343
}
340344
return c;
341345
}

0 commit comments

Comments
 (0)