Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ PHP 8.6 INTERNALS UPGRADE NOTES
. Added ZEND_CONTAINER_OF().
. The OPENBASEDIR_CHECKPATH() compatibility macro has been removed, instead
use php_check_open_basedir() directly.
. The Z_CONSTANT(), Z_CONSTANT_P(), Z_OPT_CONSTANT(), and
Z_OPT_CONSTANT_P() macros have been removed. Check for IS_CONSTANT_AST
directly.

========================
2. Build system changes
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -9207,7 +9207,7 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
if (*value_ast_ptr) {
zend_const_expr_to_zval(&value_zv, value_ast_ptr, /* allow_dynamic */ false);

if (ZEND_TYPE_IS_SET(type) && !Z_CONSTANT(value_zv)
if (ZEND_TYPE_IS_SET(type) && Z_TYPE(value_zv) != IS_CONSTANT_AST
&& !zend_is_valid_default_value(type, &value_zv)) {
zend_string *str = zend_type_to_string(type);
if (Z_TYPE(value_zv) == IS_NULL && !ZEND_TYPE_IS_INTERSECTION(type)) {
Expand Down Expand Up @@ -9331,7 +9331,7 @@ static void zend_compile_class_const_decl(zend_ast *ast, uint32_t flags, zend_as

zend_const_expr_to_zval(&value_zv, value_ast_ptr, /* allow_dynamic */ false);

if (!Z_CONSTANT(value_zv) && ZEND_TYPE_IS_SET(type) && !zend_is_valid_default_value(type, &value_zv)) {
if (Z_TYPE(value_zv) != IS_CONSTANT_AST && ZEND_TYPE_IS_SET(type) && !zend_is_valid_default_value(type, &value_zv)) {
zend_string *type_str = zend_type_to_string(type);

zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as value for class constant %s::%s of type %s",
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_ini_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void zend_ini_get_constant(zval *result, zval *name)
&& (c = zend_get_constant(Z_STR_P(name))) != 0) {
if (Z_TYPE_P(c) != IS_STRING) {
ZVAL_COPY_OR_DUP(&tmp, c);
if (Z_OPT_CONSTANT(tmp)) {
if (Z_OPT_TYPE(tmp) == IS_CONSTANT_AST) {
zval_update_constant_ex(&tmp, NULL);
}
convert_to_string(&tmp);
Expand Down
5 changes: 0 additions & 5 deletions Zend/zend_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,6 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
} while(0)

/* All data types < IS_STRING have their constructor/destructors skipped */
#define Z_CONSTANT(zval) (Z_TYPE(zval) == IS_CONSTANT_AST)
#define Z_CONSTANT_P(zval_p) Z_CONSTANT(*(zval_p))

#if 1
/* This optimized version assumes that we have a single "type_flag" */
Expand All @@ -948,9 +946,6 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#define Z_OPT_TYPE(zval) (Z_TYPE_INFO(zval) & Z_TYPE_MASK)
#define Z_OPT_TYPE_P(zval_p) Z_OPT_TYPE(*(zval_p))

#define Z_OPT_CONSTANT(zval) (Z_OPT_TYPE(zval) == IS_CONSTANT_AST)
#define Z_OPT_CONSTANT_P(zval_p) Z_OPT_CONSTANT(*(zval_p))

#define Z_OPT_REFCOUNTED(zval) Z_TYPE_INFO_REFCOUNTED(Z_TYPE_INFO(zval))
#define Z_OPT_REFCOUNTED_P(zval_p) Z_OPT_REFCOUNTED(*(zval_p))

Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -8320,7 +8320,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
val = GET_OP2_ZVAL_PTR(BP_VAR_R);

ZVAL_COPY(&c.value, val);
if (Z_OPT_CONSTANT(c.value)) {
if (Z_OPT_TYPE(c.value) == IS_CONSTANT_AST) {
if (UNEXPECTED(zval_update_constant_ex(&c.value, EX(func)->op_array.scope) != SUCCESS)) {
zval_ptr_dtor_nogc(&c.value);
FREE_OP1();
Expand Down Expand Up @@ -8352,7 +8352,7 @@ ZEND_VM_HANDLER(210, ZEND_DECLARE_ATTRIBUTED_CONST, CONST, CONST)
val = GET_OP2_ZVAL_PTR(BP_VAR_R);

ZVAL_COPY(&c.value, val);
if (Z_OPT_CONSTANT(c.value)) {
if (Z_OPT_TYPE(c.value) == IS_CONSTANT_AST) {
if (UNEXPECTED(zval_update_constant_ex(&c.value, EX(func)->op_array.scope) != SUCCESS)) {
zval_ptr_dtor_nogc(&c.value);
FREE_OP1();
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_vm_execute.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -10927,7 +10927,7 @@ static int zend_jit_recv_init(zend_jit_ctx *jit, const zend_op *opline, const ze
zv, true);
}

if (Z_CONSTANT_P(zv)) {
if (Z_TYPE_P(zv) == IS_CONSTANT_AST) {
jit_SET_EX_OPLINE(jit, opline);
ref = ir_CALL_2(IR_I32, ir_CONST_FC_FUNC(zval_update_constant_ex),
jit_ZVAL_ADDR(jit, res_addr),
Expand Down
Loading