|
@@ -79,8 +78,8 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
{
zval token;
int token_type;
- char *last_color = syntax_highlighter_ini->highlight_html;
- char *next_color;
+ const char *last_color = syntax_highlighter_ini->highlight_html;
+ const char *next_color;
zend_printf("", last_color);
/* highlight stuff coming back from zendlex() */
diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h
index 04688d65132b..2e399f408063 100644
--- a/Zend/zend_highlight.h
+++ b/Zend/zend_highlight.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -30,11 +29,11 @@
typedef struct _zend_syntax_highlighter_ini {
- char *highlight_html;
- char *highlight_comment;
- char *highlight_default;
- char *highlight_string;
- char *highlight_keyword;
+ const char *highlight_html;
+ const char *highlight_comment;
+ const char *highlight_default;
+ const char *highlight_string;
+ const char *highlight_keyword;
} zend_syntax_highlighter_ini;
diff --git a/Zend/zend_hrtime.c b/Zend/zend_hrtime.c
index 773e0525cadd..819f95c47662 100644
--- a/Zend/zend_hrtime.c
+++ b/Zend/zend_hrtime.c
@@ -1,14 +1,12 @@
/*
+----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
+ | Copyright © The PHP Group and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | https://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Niklas Keller |
| Author: Anatol Belski |
diff --git a/Zend/zend_hrtime.h b/Zend/zend_hrtime.h
index f3bc4deeaf50..464c7e571d5b 100644
--- a/Zend/zend_hrtime.h
+++ b/Zend/zend_hrtime.h
@@ -1,14 +1,12 @@
/*
+----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
+ | Copyright © The PHP Group and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | https://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Niklas Keller |
| Author: Anatol Belski |
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index ba13a3233ed2..8df6a5599d30 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -189,9 +188,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */
if (ce->constructor) {
if (parent->constructor && UNEXPECTED(parent->constructor->common.fn_flags & ZEND_ACC_FINAL)) {
- zend_error_noreturn(E_ERROR, "Cannot override final %s::%s() with %s::%s()",
- ZSTR_VAL(parent->name), ZSTR_VAL(parent->constructor->common.function_name),
- ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name));
+ zend_error_noreturn(E_ERROR, "Cannot override final %s::__construct() with %s::__construct()",
+ ZSTR_VAL(parent->name),
+ ZSTR_VAL(ce->name));
}
return;
}
@@ -537,7 +536,7 @@ static inheritance_status zend_is_class_subtype_of_type(
return INHERITANCE_SUCCESS;
}
continue;
- EMPTY_SWITCH_DEFAULT_CASE();
+ default: ZEND_UNREACHABLE();
}
}
@@ -924,7 +923,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
/* cut off on NULL byte ... class@anonymous */
smart_str_appends(&str, ZSTR_VAL(fptr->common.scope->name));
} else {
- smart_str_appendl(&str, ZSTR_VAL(fptr->common.scope->name), ZSTR_LEN(fptr->common.scope->name));
+ smart_str_append(&str, fptr->common.scope->name);
}
smart_str_appends(&str, "::");
}
@@ -1596,11 +1595,7 @@ static void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_en
ce_num = ce->num_interfaces;
- if (ce->type == ZEND_INTERNAL_CLASS) {
- ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
- } else {
- ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
- }
+ ce->interfaces = (zend_class_entry **) perealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num), ce->type == ZEND_INTERNAL_CLASS);
/* Inherit the interfaces, only if they're not already inherited by the class */
while (if_num--) {
@@ -2235,11 +2230,7 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry
} ZEND_HASH_FOREACH_END();
} else {
if (ce->num_interfaces >= current_iface_num) {
- if (ce->type == ZEND_INTERNAL_CLASS) {
- ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
- } else {
- ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num));
- }
+ ce->interfaces = (zend_class_entry **) perealloc(ce->interfaces, sizeof(zend_class_entry *) * (++current_iface_num), ce->type == ZEND_INTERNAL_CLASS);
}
ce->interfaces[ce->num_interfaces++] = iface;
@@ -2766,6 +2757,19 @@ static void emit_incompatible_trait_constant_error(
);
}
+static void emit_trait_constant_enum_case_conflict_error(
+ const zend_class_entry *ce, const zend_class_constant *trait_constant, zend_string *name
+) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use trait %s, because %s::%s conflicts with enum case %s::%s",
+ ZSTR_VAL(trait_constant->ce->name),
+ ZSTR_VAL(trait_constant->ce->name),
+ ZSTR_VAL(name),
+ ZSTR_VAL(ce->name),
+ ZSTR_VAL(name)
+ );
+}
+
static bool do_trait_constant_check(
zend_class_entry *ce, zend_class_constant *trait_constant, zend_string *name, zend_class_entry **traits, size_t current_trait
) {
@@ -2779,6 +2783,11 @@ static bool do_trait_constant_check(
zend_class_constant *existing_constant = Z_PTR_P(zv);
+ if (UNEXPECTED(ZEND_CLASS_CONST_FLAGS(existing_constant) & ZEND_CLASS_CONST_IS_CASE)) {
+ emit_trait_constant_enum_case_conflict_error(ce, trait_constant, name);
+ return false;
+ }
+
if ((ZEND_CLASS_CONST_FLAGS(trait_constant) & flags_mask) != (ZEND_CLASS_CONST_FLAGS(existing_constant) & flags_mask)) {
emit_incompatible_trait_constant_error(ce, existing_constant, trait_constant, name, traits, current_trait);
return false;
@@ -3308,7 +3317,7 @@ static void check_unrecoverable_load_failure(const zend_class_entry *ce) {
* a dependence on the inheritance hierarchy of this specific class. Instead we fall back to
* a fatal error, as would happen if we did not allow exceptions in the first place. */
if (CG(unlinked_uses)
- && zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t)ce) == SUCCESS) {
+ && zend_hash_index_del(CG(unlinked_uses), (zend_ulong)(uintptr_t)ce) == SUCCESS) {
zend_exception_uncaught_error(
"During inheritance of %s with variance dependencies", ZSTR_VAL(ce->name));
}
@@ -3603,7 +3612,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
}
if (CG(unlinked_uses)) {
- zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t) ce);
+ zend_hash_index_del(CG(unlinked_uses), (zend_ulong)(uintptr_t) ce);
}
orig_linking_class = CG(current_linking_class);
@@ -3748,6 +3757,11 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
if (ce->ce_flags & ZEND_ACC_UNRESOLVED_VARIANCE) {
resolve_delayed_variance_obligations(ce);
}
+ /* Delayed variance resolution can re-enter linking before the full
+ * hierarchy is linked. See ext/opcache/tests/gh20469*.phpt. */
+ if (CG(unlinked_uses) && zend_hash_index_exists(CG(unlinked_uses), (zend_long)(uintptr_t) ce)) {
+ ce->ce_flags &= ~ZEND_ACC_CACHEABLE;
+ }
if (ce->ce_flags & ZEND_ACC_CACHEABLE) {
ce->ce_flags &= ~ZEND_ACC_CACHEABLE;
} else {
@@ -3755,6 +3769,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
}
}
+ bool was_cacheable = is_cacheable;
if (!CG(current_linking_class)) {
is_cacheable = 0;
}
@@ -3775,6 +3790,13 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
zend_hash_destroy(ht);
FREE_HASHTABLE(ht);
}
+ } else if (was_cacheable && ce->inheritance_cache) {
+ /* Cacheability can be disabled after dependency tracking prepared
+ * an inheritance-cache dependency table. Discard it here. */
+ HashTable *ht = (HashTable*)ce->inheritance_cache;
+ ce->inheritance_cache = NULL;
+ zend_hash_destroy(ht);
+ FREE_HASHTABLE(ht);
}
if (!orig_record_errors) {
diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h
index 7171a9385f3b..fdcbd95764b3 100644
--- a/Zend/zend_inheritance.h
+++ b/Zend/zend_inheritance.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index d8f1d4f50f95..093683526d31 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Zeev Suraski |
+----------------------------------------------------------------------+
@@ -491,7 +490,7 @@ ZEND_API double zend_ini_double(const char *name, size_t name_length, bool orig)
}
/* }}} */
-ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, bool orig, bool *exists) /* {{{ */
+ZEND_API const char *zend_ini_string_ex(const char *name, size_t name_length, bool orig, bool *exists) /* {{{ */
{
zend_string *str = zend_ini_str_ex(name, name_length, orig, exists);
@@ -499,7 +498,7 @@ ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, bool ori
}
/* }}} */
-ZEND_API char *zend_ini_string(const char *name, size_t name_length, bool orig) /* {{{ */
+ZEND_API const char *zend_ini_string(const char *name, size_t name_length, bool orig) /* {{{ */
{
zend_string *str = zend_ini_str(name, name_length, orig);
@@ -562,6 +561,11 @@ ZEND_API zend_string *zend_ini_get_value(zend_string *name) /* {{{ */
ZEND_API bool zend_ini_parse_bool(const zend_string *str)
{
+ /* May happen if an unknown INI setting is queried via zend_ini_bool_literal(),
+ * as zend_ini_str() would return NULL */
+ if (UNEXPECTED(str == NULL)) {
+ return false;
+ }
if (zend_string_equals_literal_ci(str, "true")
|| zend_string_equals_literal_ci(str, "yes")
|| zend_string_equals_literal_ci(str, "on")
@@ -585,7 +589,7 @@ static const char *zend_ini_consume_quantity_prefix(const char *const digits, co
++digits_consumed;
}
- if (digits_consumed[0] == '0' && !isdigit(digits_consumed[1])) {
+ if (digits_consumed[0] == '0' && !isdigit((unsigned char)digits_consumed[1])) {
/* Value is just 0 */
if ((digits_consumed+1) == str_end) {
return digits_consumed;
@@ -643,7 +647,7 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen
}
/* if there is no digit after +/- */
- if (!isdigit(digits[0])) {
+ if (!isdigit((unsigned char)digits[0])) {
/* Escape the string to avoid null bytes and to make non-printable chars
* visible */
smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value));
@@ -657,7 +661,7 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen
}
int base = 0;
- if (digits[0] == '0' && !isdigit(digits[1])) {
+ if (digits[0] == '0' && !isdigit((unsigned char)digits[1])) {
/* Value is just 0 */
if ((digits+1) == str_end) {
*errstr = NULL;
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
index d8d7f599f461..dbe650675b66 100644
--- a/Zend/zend_ini.h
+++ b/Zend/zend_ini.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Zeev Suraski |
+----------------------------------------------------------------------+
@@ -88,13 +87,19 @@ ZEND_API void display_ini_entries(zend_module_entry *module);
ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, bool orig);
ZEND_API double zend_ini_double(const char *name, size_t name_length, bool orig);
-ZEND_API char *zend_ini_string(const char *name, size_t name_length, bool orig);
-ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, bool orig, bool *exists);
+ZEND_API const char *zend_ini_string(const char *name, size_t name_length, bool orig);
+ZEND_API const char *zend_ini_string_ex(const char *name, size_t name_length, bool orig, bool *exists);
ZEND_API zend_string *zend_ini_str(const char *name, size_t name_length, bool orig);
ZEND_API zend_string *zend_ini_str_ex(const char *name, size_t name_length, bool orig, bool *exists);
ZEND_API zend_string *zend_ini_get_value(zend_string *name);
ZEND_API bool zend_ini_parse_bool(const zend_string *str);
+#define zend_ini_bool_literal(name) zend_ini_parse_bool(zend_ini_str((name), sizeof("" name) - 1, false))
+#define zend_ini_long_literal(name) zend_ini_long((name), sizeof("" name) - 1, false)
+#define zend_ini_double_literal(name) zend_ini_double((name), sizeof("" name) - 1, false)
+#define zend_ini_str_literal(name) zend_ini_str((name), sizeof("" name) - 1, false)
+#define zend_ini_string_literal(name) zend_ini_string((name), sizeof("" name) - 1, false)
+
/**
* Parses an ini quantity
*
@@ -177,30 +182,20 @@ END_EXTERN_C()
#ifdef ZTS
#define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
+ ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr##_id)
#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
+ ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
+ ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr##_id, NULL, zend_ini_boolean_displayer_cb)
#else
#define STD_ZEND_INI_ENTRY(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
+ ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr)
#define STD_ZEND_INI_ENTRY_EX(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr, displayer) \
- ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
+ ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr, displayer)
#define STD_ZEND_INI_BOOLEAN(name, default_value, modifiable, on_modify, property_name, struct_type, struct_ptr) \
- ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
+ ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) offsetof(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb)
#endif
-#define INI_INT(name) zend_ini_long((name), strlen(name), 0)
-#define INI_FLT(name) zend_ini_double((name), strlen(name), 0)
-#define INI_STR(name) zend_ini_string_ex((name), strlen(name), 0, NULL)
-#define INI_BOOL(name) ((bool) INI_INT(name))
-
-#define INI_ORIG_INT(name) zend_ini_long((name), strlen(name), 1)
-#define INI_ORIG_FLT(name) zend_ini_double((name), strlen(name), 1)
-#define INI_ORIG_STR(name) zend_ini_string((name), strlen(name), 1)
-#define INI_ORIG_BOOL(name) ((bool) INI_ORIG_INT(name))
-
#define REGISTER_INI_ENTRIES() zend_register_ini_entries_ex(ini_entries, module_number, type)
#define UNREGISTER_INI_ENTRIES() zend_unregister_ini_entries_ex(module_number, type)
#define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 748ccd2235a6..d35853ab5acd 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -4,15 +4,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Zeev Suraski |
| Jani Taskinen |
@@ -57,7 +56,7 @@ static int get_int_val(zval *op) {
zend_string_free(Z_STR_P(op));
return val;
}
- EMPTY_SWITCH_DEFAULT_CASE()
+ default: ZEND_UNREACHABLE();
}
}
diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h
index 9a6c84fce429..c013564a10f4 100644
--- a/Zend/zend_ini_scanner.h
+++ b/Zend/zend_ini_scanner.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 5f9b77e6a3d8..7fd51654ac82 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Zeev Suraski |
| Jani Taskinen |
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index 404dd9db893e..49169dfca234 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Marcus Boerger |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h
index 883e482f510c..3aeac4fc8146 100644
--- a/Zend/zend_interfaces.h
+++ b/Zend/zend_interfaces.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Marcus Boerger |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c
index 64dbb0541a80..c05434486f89 100644
--- a/Zend/zend_iterators.c
+++ b/Zend/zend_iterators.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Wez Furlong |
| Marcus Boerger |
diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h
index 75549188ed6b..973903768405 100644
--- a/Zend/zend_iterators.h
+++ b/Zend/zend_iterators.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Wez Furlong |
| Marcus Boerger |
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index e2686c7e1c5a..b4dda00404ea 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -3,15 +3,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -821,9 +820,9 @@ parameter:
{ $$ = zend_ast_create_ex(ZEND_AST_PARAM, $1 | $3 | $4, $2, $5, NULL,
NULL, $6 ? zend_ast_create_zval_from_str($6) : NULL, $7); }
| optional_cpp_modifiers optional_type_without_static
- is_reference is_variadic T_VARIABLE backup_doc_comment '=' expr optional_property_hook_list
- { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $1 | $3 | $4, $2, $5, $8,
- NULL, $6 ? zend_ast_create_zval_from_str($6) : NULL, $9); }
+ is_reference is_variadic T_VARIABLE '=' expr backup_doc_comment optional_property_hook_list
+ { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $1 | $3 | $4, $2, $5, $7,
+ NULL, $8 ? zend_ast_create_zval_from_str($8) : NULL, $9); }
;
optional_type_without_static:
@@ -1059,13 +1058,13 @@ trait_alias:
trait_method_reference:
identifier
- { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, NULL, $1); }
+ { $$ = zend_ast_create(ZEND_AST_TRAIT_METHOD_REFERENCE, NULL, $1); }
| absolute_trait_method_reference { $$ = $1; }
;
absolute_trait_method_reference:
class_name T_PAAMAYIM_NEKUDOTAYIM identifier
- { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, $1, $3); }
+ { $$ = zend_ast_create(ZEND_AST_TRAIT_METHOD_REFERENCE, $1, $3); }
;
method_body:
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
index c494564ba234..e502d91411b5 100644
--- a/Zend/zend_language_scanner.h
+++ b/Zend/zend_language_scanner.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 1c985189fd3c..07f2d44cb5c6 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Marcus Boerger |
| Nuno Lopes |
diff --git a/Zend/zend_lazy_objects.c b/Zend/zend_lazy_objects.c
index e88ecf9fbe65..a8316768ef5f 100644
--- a/Zend/zend_lazy_objects.c
+++ b/Zend/zend_lazy_objects.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Arnaud Le Blanc |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_lazy_objects.h b/Zend/zend_lazy_objects.h
index fc0a908e7ad2..8e66ee3facd6 100644
--- a/Zend/zend_lazy_objects.h
+++ b/Zend/zend_lazy_objects.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Arnaud Le Blanc |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 10aa9174cfcc..4e96ce0ec7da 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_list.h b/Zend/zend_list.h
index 55ccf78dca10..108bd3fc3e7f 100644
--- a/Zend/zend_list.h
+++ b/Zend/zend_list.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
index 28a275e6fce7..95ce31764bfc 100644
--- a/Zend/zend_llist.c
+++ b/Zend/zend_llist.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
index 848543eba0a6..a92b8a59648c 100644
--- a/Zend/zend_llist.h
+++ b/Zend/zend_llist.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_long.h b/Zend/zend_long.h
index fef237701f3b..303bacd03d4c 100644
--- a/Zend/zend_long.h
+++ b/Zend/zend_long.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Anatol Belski |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_map_ptr.h b/Zend/zend_map_ptr.h
index 4dfa0e5043ef..af3b5178aa4a 100644
--- a/Zend/zend_map_ptr.h
+++ b/Zend/zend_map_ptr.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Dmitry Stogov |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_max_execution_timer.c b/Zend/zend_max_execution_timer.c
index 005ce14868a0..5d0eb1219c0b 100644
--- a/Zend/zend_max_execution_timer.c
+++ b/Zend/zend_max_execution_timer.c
@@ -1,14 +1,12 @@
/*
+----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
+ | Copyright © The PHP Group and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | https://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Kévin Dunglas |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_max_execution_timer.h b/Zend/zend_max_execution_timer.h
index 6557d6c91845..3839ea4cf676 100644
--- a/Zend/zend_max_execution_timer.h
+++ b/Zend/zend_max_execution_timer.h
@@ -1,14 +1,12 @@
/*
+----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
+ | Copyright © The PHP Group and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | https://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Kévin Dunglas |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_mmap.h b/Zend/zend_mmap.h
index 201fd84d074d..d56196c24687 100644
--- a/Zend/zend_mmap.h
+++ b/Zend/zend_mmap.h
@@ -1,12 +1,15 @@
/*
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+ +----------------------------------------------------------------------+
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Max Kellermann |
+----------------------------------------------------------------------+
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
index a8076c0fb905..3a98b1c06e29 100644
--- a/Zend/zend_modules.h
+++ b/Zend/zend_modules.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
diff --git a/Zend/zend_multibyte.c b/Zend/zend_multibyte.c
index f61ed79fd1f7..28be8126b117 100644
--- a/Zend/zend_multibyte.c
+++ b/Zend/zend_multibyte.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Masaki Fujimoto |
| Rui Hirokawa |
@@ -114,8 +113,8 @@ ZEND_API zend_result zend_multibyte_set_functions(const zend_multibyte_functions
* populated, we need to reinitialize script_encoding here.
*/
{
- const char *value = zend_ini_string("zend.script_encoding", sizeof("zend.script_encoding") - 1, 0);
- zend_multibyte_set_script_encoding_by_string(value, strlen(value));
+ const zend_string *value = zend_ini_str_literal("zend.script_encoding");
+ zend_multibyte_set_script_encoding_by_string(ZSTR_VAL(value), ZSTR_LEN(value));
}
return SUCCESS;
}
diff --git a/Zend/zend_multibyte.h b/Zend/zend_multibyte.h
index 16ba56ec69fd..41480ed6f86b 100644
--- a/Zend/zend_multibyte.h
+++ b/Zend/zend_multibyte.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Masaki Fujimoto |
| Rui Hirokawa |
diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h
index 716e3ba4b571..6457f85f64fb 100644
--- a/Zend/zend_multiply.h
+++ b/Zend/zend_multiply.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann |
| Ard Biesheuvel |
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 45eac02949d1..9e993627a74a 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -893,6 +892,28 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
retval = &EG(uninitialized_zval);
+ /* For initialized lazy proxies: if the real instance's magic method
+ * guard is already set for this property, we are inside a recursive
+ * call from the real instance's __get/__isset. Forward directly to
+ * the real instance to avoid double invocation. (GH-21478) */
+ if (UNEXPECTED(zend_object_is_lazy_proxy(zobj)
+ && zend_lazy_object_initialized(zobj))) {
+ zend_object *instance = zend_lazy_object_get_instance(zobj);
+ if (instance->ce->ce_flags & ZEND_ACC_USE_GUARDS) {
+ uint32_t *instance_guard = zend_get_property_guard(instance, name);
+ uint32_t guard_type = ((type == BP_VAR_IS) && zobj->ce->__isset)
+ ? IN_ISSET : IN_GET;
+ if ((*instance_guard) & guard_type) {
+ retval = zend_std_read_property(instance, name, type, cache_slot, rv);
+ if (retval == &EG(uninitialized_zval)) {
+ ZVAL_NULL(rv);
+ retval = rv;
+ }
+ return retval;
+ }
+ }
+ }
+
/* magic isset */
if ((type == BP_VAR_IS) && zobj->ce->__isset) {
zval tmp_result;
@@ -1209,6 +1230,20 @@ found:;
goto exit;
}
+ /* For initialized lazy proxies: if the real instance's __set guard
+ * is already set, we are inside a recursive call from the real
+ * instance's __set. Forward directly to avoid double invocation. */
+ if (UNEXPECTED(zend_object_is_lazy_proxy(zobj)
+ && zend_lazy_object_initialized(zobj))) {
+ zend_object *instance = zend_lazy_object_get_instance(zobj);
+ if (instance->ce->ce_flags & ZEND_ACC_USE_GUARDS) {
+ uint32_t *instance_guard = zend_get_property_guard(instance, name);
+ if ((*instance_guard) & IN_SET) {
+ return zend_std_write_property(instance, name, value, cache_slot);
+ }
+ }
+ }
+
/* magic set */
if (zobj->ce->__set) {
if (!guard) {
@@ -1409,12 +1444,24 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET) ||
UNEXPECTED(prop_info && (Z_PROP_FLAG_P(retval) & IS_PROP_UNINIT))) {
if (UNEXPECTED(zend_lazy_object_must_init(zobj) && (Z_PROP_FLAG_P(retval) & IS_PROP_LAZY))) {
- zobj = zend_lazy_object_init(zobj);
- if (!zobj) {
+ bool guarded = zobj->ce->__get
+ && (*zend_get_property_guard(zobj, name) & IN_GET);
+ zend_object *instance = zend_lazy_object_init(zobj);
+ if (!instance) {
return &EG(error_zval);
}
- return zend_std_get_property_ptr_ptr(zobj, name, type, cache_slot);
+ if (guarded && (instance->ce->ce_flags & ZEND_ACC_USE_GUARDS)) {
+ uint32_t *guard = zend_get_property_guard(instance, name);
+ if (!(*guard & IN_GET)) {
+ (*guard) |= IN_GET;
+ retval = zend_std_get_property_ptr_ptr(instance, name, type, cache_slot);
+ (*guard) &= ~IN_GET;
+ return retval;
+ }
+ }
+
+ return zend_std_get_property_ptr_ptr(instance, name, type, cache_slot);
}
if (UNEXPECTED(type == BP_VAR_RW)) {
if (prop_info) {
@@ -1457,6 +1504,25 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
}
if (EXPECTED(!zobj->ce->__get) ||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
+ if (UNEXPECTED(zend_lazy_object_must_init(zobj))) {
+ bool guarded = (zobj->ce->__get != NULL);
+ zend_object *instance = zend_lazy_object_init(zobj);
+ if (!instance) {
+ return &EG(error_zval);
+ }
+
+ if (guarded && (instance->ce->ce_flags & ZEND_ACC_USE_GUARDS)) {
+ uint32_t *guard = zend_get_property_guard(instance, name);
+ if (!(*guard & IN_GET)) {
+ (*guard) |= IN_GET;
+ retval = zend_std_get_property_ptr_ptr(instance, name, type, cache_slot);
+ (*guard) &= ~IN_GET;
+ return retval;
+ }
+ }
+
+ return zend_std_get_property_ptr_ptr(instance, name, type, cache_slot);
+ }
if (UNEXPECTED(zobj->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) {
zend_forbidden_dynamic_property(zobj->ce, name);
return &EG(error_zval);
@@ -1466,14 +1532,6 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
return &EG(error_zval);
}
}
- if (UNEXPECTED(zend_lazy_object_must_init(zobj))) {
- zobj = zend_lazy_object_init(zobj);
- if (!zobj) {
- return &EG(error_zval);
- }
-
- return zend_std_get_property_ptr_ptr(zobj, name, type, cache_slot);
- }
if (UNEXPECTED(!zobj->properties)) {
rebuild_object_properties_internal(zobj);
}
@@ -1580,6 +1638,21 @@ ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void
return;
}
+ /* For initialized lazy proxies: if the real instance's __unset guard
+ * is already set, we are inside a recursive call from the real
+ * instance's __unset. Forward directly to avoid double invocation. */
+ if (UNEXPECTED(zend_object_is_lazy_proxy(zobj)
+ && zend_lazy_object_initialized(zobj))) {
+ zend_object *instance = zend_lazy_object_get_instance(zobj);
+ if (instance->ce->ce_flags & ZEND_ACC_USE_GUARDS) {
+ uint32_t *instance_guard = zend_get_property_guard(instance, name);
+ if ((*instance_guard) & IN_UNSET) {
+ zend_std_unset_property(instance, name, cache_slot);
+ return;
+ }
+ }
+ }
+
/* magic unset */
if (zobj->ce->__unset) {
if (!guard) {
@@ -1587,9 +1660,11 @@ ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void
}
if (!((*guard) & IN_UNSET)) {
/* have unsetter - try with it! */
+ GC_ADDREF(zobj);
(*guard) |= IN_UNSET; /* prevent circular unsetting */
zend_std_call_unsetter(zobj, name);
(*guard) &= ~IN_UNSET;
+ OBJ_RELEASE(zobj);
return;
} else if (UNEXPECTED(IS_WRONG_PROPERTY_OFFSET(property_offset))) {
/* Trigger the correct error */
@@ -1750,6 +1825,18 @@ ZEND_API ZEND_ATTRIBUTE_NONNULL zend_function *zend_get_call_trampoline_func(
}
/* }}} */
+ZEND_API void zend_free_trampoline(zend_function *func)
+{
+ ZEND_ASSERT(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE);
+
+ if (func == &EG(trampoline)) {
+ EG(trampoline).common.attributes = NULL;
+ EG(trampoline).common.function_name = NULL;
+ } else {
+ efree(func);
+ }
+}
+
static ZEND_FUNCTION(zend_parent_hook_get_trampoline)
{
zend_object *obj = Z_PTR_P(ZEND_THIS);
@@ -2101,12 +2188,16 @@ ZEND_API ZEND_COLD bool zend_std_unset_static_property(const zend_class_entry *c
static ZEND_COLD zend_never_inline void zend_bad_constructor_call(const zend_function *constructor, const zend_class_entry *scope) /* {{{ */
{
if (scope) {
- zend_throw_error(NULL, "Call to %s %s::%s() from scope %s",
- zend_visibility_string(constructor->common.fn_flags), ZSTR_VAL(constructor->common.scope->name),
- ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(scope->name)
+ zend_throw_error(NULL, "Call to %s %s::__construct() from scope %s",
+ zend_visibility_string(constructor->common.fn_flags),
+ ZSTR_VAL(constructor->common.scope->name),
+ ZSTR_VAL(scope->name)
);
} else {
- zend_throw_error(NULL, "Call to %s %s::%s() from global scope", zend_visibility_string(constructor->common.fn_flags), ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name));
+ zend_throw_error(NULL, "Call to %s %s::__construct() from global scope",
+ zend_visibility_string(constructor->common.fn_flags),
+ ZSTR_VAL(constructor->common.scope->name)
+ );
}
}
/* }}} */
@@ -2376,6 +2467,20 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has
goto exit;
}
+ /* For initialized lazy proxies: if the real instance's __isset guard
+ * is already set, we are inside a recursive call from the real
+ * instance's __isset. Forward directly to avoid double invocation. */
+ if (UNEXPECTED(zend_object_is_lazy_proxy(zobj)
+ && zend_lazy_object_initialized(zobj))) {
+ zend_object *instance = zend_lazy_object_get_instance(zobj);
+ if (instance->ce->ce_flags & ZEND_ACC_USE_GUARDS) {
+ uint32_t *instance_guard = zend_get_property_guard(instance, name);
+ if ((*instance_guard) & IN_ISSET) {
+ return zend_std_has_property(instance, name, has_set_exists, cache_slot);
+ }
+ }
+ }
+
if (!zobj->ce->__isset) {
goto lazy_init;
}
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 3e922343eb15..8ed4803c3f0e 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -205,7 +204,7 @@ typedef zend_result (*zend_object_do_operation_t)(uint8_t opcode, zval *result,
struct _zend_object_handlers {
/* offset of real object header (usually zero) */
- int offset;
+ size_t offset;
/* object handlers */
zend_object_free_obj_t free_obj; /* required */
zend_object_dtor_obj_t dtor_obj; /* required */
@@ -237,11 +236,10 @@ struct _zend_object_handlers {
BEGIN_EXTERN_C()
extern const ZEND_API zend_object_handlers std_object_handlers;
-#define zend_get_std_object_handlers() \
- (&std_object_handlers)
-
-#define zend_get_function_root_class(fbc) \
- ((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
+static zend_always_inline const zend_object_handlers *zend_get_std_object_handlers(void)
+{
+ return &std_object_handlers;
+}
#define ZEND_PROPERTY_ISSET 0x0 /* Property exists and is not NULL */
#define ZEND_PROPERTY_NOT_EMPTY ZEND_ISEMPTY /* Property is not empty */
@@ -291,18 +289,20 @@ static zend_always_inline HashTable *zend_std_get_properties_ex(zend_object *obj
/* Implements the fast path for array cast */
ZEND_API HashTable *zend_std_build_object_properties_array(zend_object *zobj);
-#define ZEND_STD_BUILD_OBJECT_PROPERTIES_ARRAY_COMPATIBLE(object) ( \
- /* We can use zend_std_build_object_properties_array() for objects \
- * without properties ht and with standard handlers */ \
- Z_OBJ_P(object)->properties == NULL \
- && Z_OBJ_HT_P(object)->get_properties_for == NULL \
- && Z_OBJ_HT_P(object)->get_properties == zend_std_get_properties \
- /* For initialized proxies we need to forward to the real instance */ \
- && ( \
- !zend_object_is_lazy_proxy(Z_OBJ_P(object)) \
- || !zend_lazy_object_initialized(Z_OBJ_P(object)) \
- ) \
-)
+static zend_always_inline bool ZEND_STD_BUILD_OBJECT_PROPERTIES_ARRAY_COMPATIBLE(const zval *zv) {
+ /* We can use zend_std_build_object_properties_array() for objects
+ * without properties ht and with standard handlers */
+ const zend_object *obj = Z_OBJ_P(zv);
+
+ return obj->properties == NULL
+ && obj->handlers->get_properties_for == NULL
+ && obj->handlers->get_properties == zend_std_get_properties
+ /* For initialized proxies we need to forward to the real instance */
+ && (
+ !zend_object_is_lazy_proxy(obj)
+ || !zend_lazy_object_initialized(obj)
+ );
+}
/* Handler for objects that cannot be meaningfully compared.
* Only objects with the same identity will be considered equal. */
@@ -313,6 +313,7 @@ ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_
ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_string *prop_info_name, bool is_dynamic);
ZEND_API ZEND_ATTRIBUTE_NONNULL zend_function *zend_get_call_trampoline_func(const zend_function *fbc, zend_string *method_name);
+ZEND_API void zend_free_trampoline(zend_function *func);
ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *member);
@@ -336,20 +337,12 @@ ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_p
void zend_object_handlers_startup(void);
-#define zend_release_properties(ht) do { \
- if (ht) { \
- zend_array_release(ht); \
- } \
-} while (0)
-
-#define zend_free_trampoline(func) do { \
- if ((func) == &EG(trampoline)) { \
- EG(trampoline).common.attributes = NULL; \
- EG(trampoline).common.function_name = NULL; \
- } else { \
- efree(func); \
- } \
- } while (0)
+static zend_always_inline void zend_release_properties(HashTable *ht)
+{
+ if (ht) {
+ zend_array_release(ht);
+ }
+}
/* Fallback to default comparison implementation if the arguments aren't both objects
* and have the same compare() handler. You'll likely want to use this unless you
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index 6f6a82638944..2fc264742cd1 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -194,14 +193,14 @@ ZEND_API zend_object* ZEND_FASTCALL zend_objects_new(zend_class_entry *ce)
return object;
}
-ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object, zend_object *old_object)
+ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object, const zend_object *old_object)
{
bool has_clone_method = old_object->ce->clone != NULL;
if (old_object->ce->default_properties_count) {
- zval *src = old_object->properties_table;
+ const zval *src = old_object->properties_table;
zval *dst = new_object->properties_table;
- zval *end = src + old_object->ce->default_properties_count;
+ const zval *end = src + old_object->ce->default_properties_count;
do {
i_zval_ptr_dtor(dst);
diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h
index 712fd442da5a..0930fa043101 100644
--- a/Zend/zend_objects.h
+++ b/Zend/zend_objects.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -25,7 +24,7 @@
BEGIN_EXTERN_C()
ZEND_API void ZEND_FASTCALL zend_object_std_init(zend_object *object, zend_class_entry *ce);
ZEND_API zend_object* ZEND_FASTCALL zend_objects_new(zend_class_entry *ce);
-ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object, zend_object *old_object);
+ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object, const zend_object *old_object);
ZEND_API void zend_object_std_dtor(zend_object *object);
ZEND_API void zend_objects_destroy_object(zend_object *object);
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index c19873cf3be3..537cad8a3644 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at . |
+ | |
+ | SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans |
| Zeev Suraski |
@@ -44,8 +43,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_sto
{
EG(flags) |= EG_FLAGS_OBJECT_STORE_NO_REUSE;
if (objects->top > 1) {
- uint32_t i;
- for (i = 1; i < objects->top; i++) {
+ for (uint32_t i = 1; i < objects->top; i++) {
zend_object *obj = objects->object_buckets[i];
if (IS_OBJ_VALID(obj)) {
if (!(OBJ_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
@@ -128,20 +126,19 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_free_object_storage(zend_objects_
/* Store objects API */
static ZEND_COLD zend_never_inline void ZEND_FASTCALL zend_objects_store_put_cold(zend_object *object)
{
- int handle;
uint32_t new_size = 2 * EG(objects_store).size;
EG(objects_store).object_buckets = (zend_object **) erealloc(EG(objects_store).object_buckets, new_size * sizeof(zend_object*));
/* Assign size after realloc, in case it fails */
EG(objects_store).size = new_size;
- handle = EG(objects_store).top++;
+ uint32_t handle = EG(objects_store).top++;
object->handle = handle;
EG(objects_store).object_buckets[handle] = object;
}
ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object)
{
- int handle;
+ uint32_t handle;
/* When in shutdown sequence - do not reuse previously freed handles, to make sure
* the dtors for newly created objects are called in zend_objects_store_call_destructors() loop
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index 86c3a49f8c8c..434ac4499e7f 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -2,15 +2,14 @@
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
- | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ | Copyright © Zend Technologies Ltd., a subsidiary company of |
+ | Perforce Software, Inc., and Contributors. |
+----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
+ | This source file is subject to the Modified BSD License that is |
+ | bundled with this package in the file LICENSE, and is available |
+ | through the World Wide Web at