Skip to content
Merged
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
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ PHP NEWS
- SimpleXML:
. Fixed bug #75245 (Don't set content of elements with only whitespaces).
(eriklundin)
. Fixed bug #63575 (Root elements are not properly cloned). (cmb)

- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
Expand Down
8 changes: 7 additions & 1 deletion UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ PHP 8.0 UPGRADE NOTES

- Sysvmsg:
. msg_get_queue() will now return an SysvMessageQueue object rather than a
resource. Return value checks using is_resource() should be replaced with
resource. Return value checks using is_resource() should be replaced with
checks for `false`.

- Sysvsem:
Expand Down Expand Up @@ -474,6 +474,12 @@ PHP 8.0 UPGRADE NOTES

- Zlib:
. gzgetss() has been removed.
. inflate_init() will now return an InflateContext object rather than a
resource. Return value checks using is_resource() should be replaced with
checks for `false`.
. deflate_init() will now return a DeflateContext object rather than a
resource. Return value checks using is_resource() should be replaced with
checks for `false`.

========================================
2. New Features
Expand Down
19 changes: 0 additions & 19 deletions Zend/Zend.m4
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,9 @@ AC_ARG_ENABLE([zts],
[ZEND_ZTS=$enableval],
[ZEND_ZTS=no])

AC_ARG_ENABLE([inline-optimization],
[AS_HELP_STRING([--disable-inline-optimization],
[If building zend_execute.lo fails, try this switch])],
[ZEND_INLINE_OPTIMIZATION=$enableval],
[ZEND_INLINE_OPTIMIZATION=yes])

AC_MSG_CHECKING(whether to enable thread-safety)
AC_MSG_RESULT($ZEND_ZTS)

AC_MSG_CHECKING(whether to enable inline optimization for GCC)
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)

AC_MSG_CHECKING(whether to enable Zend debugging)
AC_MSG_RESULT($ZEND_DEBUG)

Expand All @@ -232,18 +223,8 @@ if test "$ZEND_ZTS" = "yes"; then
CFLAGS="$CFLAGS -DZTS"
fi

changequote({,})
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
else
INLINE_CFLAGS="$CFLAGS"
fi
changequote([,])

AC_C_INLINE

AC_SUBST(INLINE_CFLAGS)

AC_MSG_CHECKING(target system is Darwin)
if echo "$target" | grep "darwin" > /dev/null; then
AC_DEFINE([DARWIN], 1, [Define if the target system is darwin])
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ZEND_INI_BEGIN()
ZEND_INI_ENTRY("zend.script_encoding", NULL, ZEND_INI_ALL, OnUpdateScriptEncoding)
STD_ZEND_INI_BOOLEAN("zend.detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
#ifdef ZEND_SIGNALS
STD_ZEND_INI_BOOLEAN("zend.signal_check", "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
STD_ZEND_INI_BOOLEAN("zend.signal_check", ZEND_DEBUG ? "1" : "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
#endif
STD_ZEND_INI_BOOLEAN("zend.exception_ignore_args", "0", ZEND_INI_ALL, OnUpdateBool, exception_ignore_args, zend_executor_globals, executor_globals)
ZEND_INI_END()
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ END_EXTERN_C()
#define RETVAL_ARR(r) ZVAL_ARR(return_value, r)
#define RETVAL_EMPTY_ARRAY() ZVAL_EMPTY_ARRAY(return_value)
#define RETVAL_OBJ(r) ZVAL_OBJ(return_value, r)
#define RETVAL_OBJ_COPY(r) ZVAL_OBJ_COPY(return_value, r)
#define RETVAL_COPY(zv) ZVAL_COPY(return_value, zv)
#define RETVAL_COPY_VALUE(zv) ZVAL_COPY_VALUE(return_value, zv)
#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
Expand All @@ -740,6 +741,7 @@ END_EXTERN_C()
#define RETURN_ARR(r) do { RETVAL_ARR(r); return; } while (0)
#define RETURN_EMPTY_ARRAY() do { RETVAL_EMPTY_ARRAY(); return; } while (0)
#define RETURN_OBJ(r) do { RETVAL_OBJ(r); return; } while (0)
#define RETURN_OBJ_COPY(r) do { RETVAL_OBJ_COPY(r); return; } while (0)
#define RETURN_COPY(zv) do { RETVAL_COPY(zv); return; } while (0)
#define RETURN_COPY_VALUE(zv) do { RETVAL_COPY_VALUE(zv); return; } while (0)
#define RETURN_ZVAL(zv, copy, dtor) do { RETVAL_ZVAL(zv, copy, dtor); return; } while (0)
Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2069,9 +2069,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
}
zend_hash_add_new(Z_ARRVAL(stack_frame), ZSTR_KNOWN(ZEND_STR_CLASS), &tmp);
if ((options & DEBUG_BACKTRACE_PROVIDE_OBJECT) != 0) {
ZVAL_OBJ(&tmp, object);
ZVAL_OBJ_COPY(&tmp, object);
zend_hash_add_new(Z_ARRVAL(stack_frame), ZSTR_KNOWN(ZEND_STR_OBJECT), &tmp);
Z_ADDREF(tmp);
}

ZVAL_INTERNED_STR(&tmp, ZSTR_KNOWN(ZEND_STR_OBJECT_OPERATOR));
Expand Down
6 changes: 2 additions & 4 deletions Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ static int zend_create_closure_from_callable(zval *return_value, zval *callable,
/* For Closure::fromCallable([$closure, "__invoke"]) return $closure. */
if (fcc.object && fcc.object->ce == zend_ce_closure
&& zend_string_equals_literal(mptr->common.function_name, "__invoke")) {
ZVAL_OBJ(return_value, fcc.object);
GC_ADDREF(fcc.object);
RETVAL_OBJ_COPY(fcc.object);
zend_free_trampoline(mptr);
return SUCCESS;
}
Expand Down Expand Up @@ -725,8 +724,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
if (scope) {
closure->func.common.fn_flags |= ZEND_ACC_PUBLIC;
if (this_ptr && Z_TYPE_P(this_ptr) == IS_OBJECT && (closure->func.common.fn_flags & ZEND_ACC_STATIC) == 0) {
Z_ADDREF_P(this_ptr);
ZVAL_OBJ(&closure->this_ptr, Z_OBJ_P(this_ptr));
ZVAL_OBJ_COPY(&closure->this_ptr, Z_OBJ_P(this_ptr));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5906,7 +5906,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32_t fall
zend_op_array *op_array = CG(active_op_array);
zend_class_entry *scope = op_array->scope;
zend_bool is_ctor =
scope && zend_string_equals_literal_ci(op_array->function_name, "__construct");
scope && zend_is_constructor(op_array->function_name);
if (!is_ctor) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot declare promoted property outside a constructor");
Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_generators.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,7 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
zend_iterator_init(iterator);

iterator->funcs = &zend_generator_iterator_functions;
Z_ADDREF_P(object);
ZVAL_OBJ(&iterator->data, Z_OBJ_P(object));
ZVAL_OBJ_COPY(&iterator->data, Z_OBJ_P(object));

return iterator;
}
Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -2416,8 +2416,7 @@ static void check_unrecoverable_load_failure(zend_class_entry *ce) {
zend_string *exception_str;
zval exception_zv;
ZEND_ASSERT(EG(exception) && "Exception must have been thrown");
ZVAL_OBJ(&exception_zv, EG(exception));
Z_ADDREF(exception_zv);
ZVAL_OBJ_COPY(&exception_zv, EG(exception));
zend_clear_exception();
exception_str = zval_get_string(&exception_zv);
zend_error_noreturn(E_ERROR,
Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zva

zend_iterator_init((zend_object_iterator*)iterator);

Z_ADDREF_P(object);
ZVAL_OBJ(&iterator->it.data, Z_OBJ_P(object));
ZVAL_OBJ_COPY(&iterator->it.data, Z_OBJ_P(object));
iterator->it.funcs = &zend_interface_iterator_funcs_iterator;
iterator->ce = Z_OBJCE_P(object);
ZVAL_UNDEF(&iterator->value);
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ void zend_signal_activate(void)

SIGG(active) = 1;
SIGG(depth) = 0;
SIGG(check) = ZEND_DEBUG;
} /* }}} */

/* {{{ zend_signal_deactivate
Expand Down
8 changes: 8 additions & 0 deletions Zend/zend_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,14 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
Z_TYPE_INFO_P(__z) = IS_OBJECT_EX; \
} while (0)

#define ZVAL_OBJ_COPY(z, o) do { \
zval *__z = (z); \
zend_object *__o = (o); \
GC_ADDREF(__o); \
Z_OBJ_P(__z) = __o; \
Z_TYPE_INFO_P(__z) = IS_OBJECT_EX; \
} while (0)

#define ZVAL_RES(z, r) do { \
zval *__z = (z); \
Z_RES_P(__z) = (r); \
Expand Down
12 changes: 4 additions & 8 deletions Zend/zend_weakrefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ static zend_always_inline zend_bool zend_weakref_find(zval *referent, zval *retu
zend_weakref *wr;
found_weakref:
wr = ptr;
GC_ADDREF(&wr->std);
ZVAL_OBJ(return_value, &wr->std);
RETVAL_OBJ_COPY(&wr->std);
return 1;
}

Expand Down Expand Up @@ -221,8 +220,7 @@ static zend_always_inline void zend_weakref_get(zval *weakref, zval *return_valu
zend_weakref *wr = zend_weakref_fetch(weakref);

if (wr->referent) {
ZVAL_OBJ(return_value, wr->referent);
Z_ADDREF_P(return_value);
RETVAL_OBJ_COPY(wr->referent);
}
}

Expand Down Expand Up @@ -433,8 +431,7 @@ static HashTable *zend_weakmap_get_properties_for(zend_object *object, zend_prop
zval obj_zv;
array_init(&pair);

ZVAL_OBJ(&obj_zv, (zend_object *) obj_addr);
Z_ADDREF(obj_zv);
ZVAL_OBJ_COPY(&obj_zv, (zend_object *) obj_addr);
add_assoc_zval(&pair, "key", &obj_zv);
Z_TRY_ADDREF_P(val);
add_assoc_zval(&pair, "value", val);
Expand Down Expand Up @@ -511,8 +508,7 @@ static void zend_weakmap_iterator_get_current_key(zend_object_iterator *obj_iter
ZEND_ASSERT(0 && "Must have integer key");
}

ZVAL_OBJ(key, (zend_object *) num_key);
Z_ADDREF_P(key);
ZVAL_OBJ_COPY(key, (zend_object *) num_key);
}

static void zend_weakmap_iterator_move_forward(zend_object_iterator *obj_iter)
Expand Down
14 changes: 1 addition & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,6 @@ old_CC=$CC

if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
CPPFLAGS="$CPPFLAGS $ac_cv_pthreads_cflags"
fi

Expand Down Expand Up @@ -1425,7 +1424,6 @@ PHP_CONFIGURE_PART(Generating files)
CXXFLAGS_CLEAN=$CXXFLAGS
CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"

if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
Expand Down Expand Up @@ -1470,24 +1468,14 @@ PHP_ADD_SOURCES(Zend, \
zend_execute_API.c zend_highlight.c zend_llist.c \
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
zend_list.c zend_builtin_functions.c zend_attributes.c \
zend_list.c zend_builtin_functions.c zend_attributes.c zend_execute.c \
zend_ini.c zend_sort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
zend_closures.c zend_weakrefs.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c, \
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)

dnl Selectively disable optimization due to high RAM usage during compiling the
dnl executor.
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
flag=-O0
else
flag=
fi

PHP_ADD_SOURCES_X(Zend, zend_execute.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,PHP_GLOBAL_OBJS,,$flag)

PHP_ADD_BUILD_DIR(main main/streams)
PHP_ADD_BUILD_DIR(TSRM)
PHP_ADD_BUILD_DIR(Zend)
Expand Down
Loading