Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b092f3f
Require Autoconf 2.71 or newer (#21159)
petk Sep 25, 2026
5244ba7
zend_portability: Simplify check for `max_align_t` (#21229)
TimWolla Sep 25, 2026
b5526aa
Fix OSS-Fuzz #565486253: coerced arg with '...' on non-variadic function
ndossche Sep 24, 2026
8991945
Merge branch 'PHP-8.6'
ndossche Sep 25, 2026
c5e45a1
tree-wide: Replace `ZEND_STATIC_ASSERT()` by `static_assert()` (#21228)
TimWolla Sep 25, 2026
6eb8d06
Fix GH-23897: php:function() assertion after failed registerPHPFuncti…
devnexen Sep 25, 2026
a8927bc
Merge branch 'PHP-8.4' into PHP-8.5
devnexen Sep 25, 2026
2e34c09
Merge branch 'PHP-8.5' into PHP-8.6
devnexen Sep 25, 2026
03b57bd
Merge branch 'PHP-8.6'
devnexen Sep 25, 2026
c06e737
ext/opcache: Fix GH-23679 tracing JIT shadowed private writes
iliaal Sep 13, 2026
3e6ddcb
Merge branch 'PHP-8.5' into PHP-8.6
iliaal Sep 25, 2026
c41ad31
Merge branch 'PHP-8.6'
iliaal Sep 25, 2026
436cccb
[skip ci] Sync .github files
iluuu1994 Sep 25, 2026
0ccb94a
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 Sep 25, 2026
67e2253
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 Sep 25, 2026
4259bba
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 Sep 25, 2026
172cfbc
Merge branch 'PHP-8.5' into PHP-8.6
iluuu1994 Sep 25, 2026
602b000
Merge branch 'PHP-8.6'
iluuu1994 Sep 25, 2026
1b8d390
[skip ci] Skip recursion tests on ASAN
iluuu1994 Sep 25, 2026
cb6116a
Merge branch 'PHP-8.2' into PHP-8.3
iluuu1994 Sep 25, 2026
4b34a3b
Merge branch 'PHP-8.3' into PHP-8.4
iluuu1994 Sep 25, 2026
76b8549
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 Sep 25, 2026
a6a7bac
Merge branch 'PHP-8.5' into PHP-8.6
iluuu1994 Sep 25, 2026
5b791db
Merge branch 'PHP-8.6'
iluuu1994 Sep 25, 2026
fa7734f
#if out zend_class_constants_are_updated() in release builds
iluuu1994 Sep 25, 2026
2cb6586
Merge branch 'PHP-8.4' into PHP-8.5
iluuu1994 Sep 25, 2026
7f56584
Merge branch 'PHP-8.5' into PHP-8.6
iluuu1994 Sep 25, 2026
69ca307
Merge branch 'PHP-8.6'
iluuu1994 Sep 25, 2026
8cb57d2
ext/pcntl: do not drop queued signals when an exception is pending (#…
nicolas-grekas Sep 25, 2026
3cab493
Merge branch 'PHP-8.4' into PHP-8.5
arnaud-lb Sep 25, 2026
0c24446
Merge branch 'PHP-8.5' into PHP-8.6
arnaud-lb Sep 25, 2026
3d97985
Merge branch 'PHP-8.6'
arnaud-lb Sep 25, 2026
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
4 changes: 4 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ PHP 8.7 INTERNALS UPGRADE NOTES

- Removed zend_execute_scripts(). Manually call zend_execute_script() in a loop
instead.
- Removed ZEND_STATIC_ASSERT(). Use C11 static_assert() directly instead.

========================
2. Build system changes
========================

- Unix build system changes:
. Autoconf minimum required version upgraded to 2.71.

========================
3. Module changes
========================
Expand Down
8 changes: 4 additions & 4 deletions Zend/Zend.m4
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ dnl
AC_DEFUN([ZEND_INIT], [dnl
AC_REQUIRE([AC_PROG_CC])

AC_CHECK_HEADERS(m4_normalize([
AC_CHECK_HEADERS([
cpuid.h
libproc.h
]))
])

dnl Check for library functions.
AC_CHECK_FUNCS(m4_normalize([
AC_CHECK_FUNCS([
getpid
gettid
kill
Expand All @@ -151,7 +151,7 @@ AC_CHECK_FUNCS(m4_normalize([
pthread_getthrds_np
pthread_stackseg_np
strnlen
]))
])

AC_CHECK_DECL([clock_gettime_nsec_np],
[AC_DEFINE([HAVE_CLOCK_GETTIME_NSEC_NP], [1],
Expand Down
35 changes: 35 additions & 0 deletions Zend/tests/partial_application/const_arg_opt_004.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--TEST--
Constant argument optimization - coerced arg with '...' on non-variadic function
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.file_update_protection=0
--FILE--
<?php
function g(string $s, $x = 1) {
var_dump($s, func_get_args());
}

$f = g(15, ...);
$f();
$f(2, 3);

?>
--EXPECT--
string(2) "15"
array(2) {
[0]=>
string(2) "15"
[1]=>
int(1)
}
string(2) "15"
array(3) {
[0]=>
string(2) "15"
[1]=>
int(2)
[2]=>
int(3)
}
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5944,7 +5944,7 @@ static void zend_compile_static_var_common(zend_string *var_name, zval *value, u
opline->op1_type = IS_CV;
opline->op1.var = lookup_cv(var_name);

ZEND_STATIC_ASSERT(sizeof(Bucket) % 8 == 0, "Bucket size not compatible with storing flags in lower three bits");
static_assert(sizeof(Bucket) % 8 == 0, "Bucket size not compatible with storing flags in lower three bits");
opline->extended_value = (uint32_t)((char*)value - (char*)CG(active_op_array)->static_variables->arData) | mode;
}
/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ struct _zend_execute_data {
(call)->This.u2.num_args

/* Ensure the correct alignment before slots calculation */
ZEND_STATIC_ASSERT(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
static_assert(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
"zval must be aligned by ZEND_MM_ALIGNMENT");
/* A number of call frame slots (zvals) reserved for zend_execute_data. */
#define ZEND_CALL_FRAME_SLOT \
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ struct _zend_vm_stack {
};

/* Ensure the correct alignment before slots calculation */
ZEND_STATIC_ASSERT(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
static_assert(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
"zval must be aligned by ZEND_MM_ALIGNMENT");
/* A number of call frame slots (zvals) reserved for _zend_vm_stack. */
#define ZEND_VM_STACK_HEADER_SLOTS \
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_lazy_objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ bool zend_lazy_object_decr_lazy_props(const zend_object *obj)
return info->lazy_properties_count == 0;
}

#if ZEND_DEBUG
/* See zend_update_class_constants(). */
static zend_always_inline bool zend_class_constants_are_updated(const zend_class_entry *ce) {
if (ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED) {
Expand All @@ -189,6 +190,7 @@ static zend_always_inline bool zend_class_constants_are_updated(const zend_class
}
return false;
}
#endif

/**
* Making objects lazy
Expand Down
11 changes: 7 additions & 4 deletions Zend/zend_partial.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,10 @@ static zend_ast *zp_compile_forwarding_call(
ZEND_ASSERT(!Z_REFCOUNTED(argv[offset]));

/* This argument never changes, so we can burn it into the op_array
* and check its type ahead of time. */
* and check its type ahead of time.
* Work with a value copy because a scalar type check may coerce this value. */
zval value;
ZVAL_COPY_VALUE(&value, &argv[offset]);

zend_arg_info *arg_info;
if (offset < function->common.num_args) {
Expand All @@ -577,18 +580,18 @@ static zend_ast *zp_compile_forwarding_call(
arg_info = NULL;
}
if (arg_info && ZEND_TYPE_IS_SET(arg_info->type)
&& UNEXPECTED(!zend_check_type_ex(&arg_info->type, &argv[offset],
&& UNEXPECTED(!zend_check_type_ex(&arg_info->type, &value,
/* current_frame */ true, /* is_internal */ false))) {
zend_string *need_msg = zend_type_to_string_resolved(arg_info->type,
function->common.scope);
zend_argument_type_error_ex(function, offset + 1,
"must be of type %s, %s given",
ZSTR_VAL(need_msg), zend_zval_value_name(&argv[offset]));
ZSTR_VAL(need_msg), zend_zval_value_name(&value));
zend_string_release(need_msg);
goto error;
}

args_ast = zend_ast_list_add(args_ast, zend_ast_create_zval(&argv[offset]));
args_ast = zend_ast_list_add(args_ast, zend_ast_create_zval(&value));
} else {
args_ast = zend_ast_list_add(args_ast, zend_ast_create(ZEND_AST_VAR,
zend_ast_create_zval_from_str(zend_string_copy(var_names->params[offset]))));
Expand Down
11 changes: 1 addition & 10 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -862,16 +862,7 @@ extern "C++" {
/** @deprecated */
#define ZEND_CGG_DIAGNOSTIC_IGNORED_END ZEND_DIAGNOSTIC_IGNORED_END

#if defined(__cplusplus)
# define ZEND_STATIC_ASSERT(c, m) static_assert((c), m)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# define ZEND_STATIC_ASSERT(c, m) _Static_assert((c), m)
#else
# define ZEND_STATIC_ASSERT(c, m)
#endif

#if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) /* C11 */ \
|| (defined(__cplusplus) && __cplusplus >= 201103L) /* C++11 */) && !defined(ZEND_WIN32)
#if !defined(ZEND_WIN32)
typedef max_align_t zend_max_align_t;
#else
typedef union {
Expand Down
32 changes: 11 additions & 21 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ m4_include([Zend/Zend.m4])
dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------

AC_PREREQ([2.68])
AC_PREREQ([2.71])
AC_INIT([PHP],[8.7.0-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_MACRO_DIR([build])
AC_CONFIG_MACRO_DIRS([build])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER

Expand Down Expand Up @@ -120,11 +120,14 @@ dnl ----------------------------------------------------------------------------

PKG_PROG_PKG_CONFIG
AC_PROG_CC([cc gcc])

dnl Check if C compiler accepts C11.
AS_CASE([$ac_prog_cc_stdc], [c99|c89|no],
[AC_MSG_ERROR([C compiler would not accept C11 code.])])

PHP_DETECT_ICC
PHP_DETECT_SUNCC

dnl AC_PROG_CC_C99 is obsolete with autoconf >= 2.70 yet necessary for <= 2.69.
m4_version_prereq([2.70],,[AC_PROG_CC_C99])
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_LN_S
Expand All @@ -135,17 +138,6 @@ AS_VAR_IF([cross_compiling], [yes],
AC_MSG_RESULT([$BUILD_CC])],
[BUILD_CC=$CC])

dnl The macro AC_PROG_CC_C99 sets the shell variable ac_cv_prog_cc_c99 to 'no'
dnl if the compiler does not support C99.i.e. does not support any of _Bool,
dnl flexible arrays, inline, long long int, mixed code and declarations,
dnl named initialization of structs, restrict, varargs macros, variable
dnl declarations in for loops and variable length arrays.
dnl
dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C-Compiler.html
if test "$ac_cv_prog_cc_c99" = no; then
AC_MSG_ERROR([C compiler would not accept C99 code])
fi

dnl Support systems with system libraries in e.g. /usr/lib64.
PHP_ARG_WITH([libdir],
[for system library directory],
Expand Down Expand Up @@ -380,7 +372,7 @@ dnl Then headers.
dnl ----------------------------------------------------------------------------

dnl QNX requires unix.h to allow functions in libunix to work properly.
AC_CHECK_HEADERS(m4_normalize([
AC_CHECK_HEADERS([
dirent.h
sys/param.h
sys/types.h
Expand Down Expand Up @@ -428,7 +420,7 @@ AC_CHECK_HEADERS(m4_normalize([
nmmintrin.h
wmmintrin.h
immintrin.h
]),,, [dnl
],,, [dnl
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
Expand All @@ -452,8 +444,6 @@ PHP_BROKEN_GETCWD
AS_VAR_IF([GCC], [yes], [PHP_BROKEN_GCC_STRLEN_OPT])

dnl Detect the headers required to use makedev, major, and minor.
dnl Autoconf <= 2.69 didn't check glibc 2.25 deprecated macros in sys/types.h.
m4_version_prereq([2.70],,[ac_cv_header_sys_types_h_makedev=no])
AC_HEADER_MAJOR

dnl Checks for typedefs, structures, and compiler characteristics.
Expand Down Expand Up @@ -546,7 +536,7 @@ PHP_CHECK_VARIABLE_ATTRIBUTE([aligned])
dnl Checks for library functions.
dnl ----------------------------------------------------------------------------

AC_CHECK_FUNCS(m4_normalize([
AC_CHECK_FUNCS([
alphasort
asctime_r
asprintf
Expand Down Expand Up @@ -609,7 +599,7 @@ AC_CHECK_FUNCS(m4_normalize([
usleep
utime
vasprintf
]))
])

PHP_ARG_ENABLE([system-glob],
[whether to use the system glob function],
Expand Down
4 changes: 2 additions & 2 deletions ext/date/time_duration.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#define NANOS_IN_MILLI 1000000
#define MILLIS_IN_SEC 1000

ZEND_STATIC_ASSERT(NANOS_IN_MICRO * MICROS_IN_SEC == NANOS_IN_SEC, "");
ZEND_STATIC_ASSERT(NANOS_IN_MILLI * MILLIS_IN_SEC == NANOS_IN_SEC, "");
static_assert(NANOS_IN_MICRO * MICROS_IN_SEC == NANOS_IN_SEC, "");
static_assert(NANOS_IN_MILLI * MILLIS_IN_SEC == NANOS_IN_SEC, "");

#define Z_PARAM_ULONG(l) { \
zend_long __##l; \
Expand Down
25 changes: 25 additions & 0 deletions ext/dom/tests/gh23897.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
GH-23897 (Assertion failure in php_dom_xpath_callback_dispatch() after failed registerPhpFunctions())
--EXTENSIONS--
dom
--FILE--
<?php
$dom = new DOMDocument();
$dom->loadXML('<root/>');

$xpath = new DOMXPath($dom);
$xpath->registerNamespace('php', 'http://php.net/xpath');
try {
$xpath->registerPhpFunctions('testPhpFunction');
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump($xpath->evaluate('php:function("testPhpFunction")'));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
TypeError: DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "testPhpFunction" not found or invalid function name
Error: No callbacks were registered
2 changes: 1 addition & 1 deletion ext/dom/xpath_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static zend_result php_dom_xpath_callback_dispatch(php_dom_xpath_callbacks *xpat
{
zval callback_retval;

if (UNEXPECTED(ns == NULL)) {
if (UNEXPECTED(ns == NULL || ns->mode == PHP_DOM_REG_FUNC_MODE_NONE)) {
zend_throw_error(NULL, "No callbacks were registered");
return FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/ldap/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ if test "$PHP_LDAP" != "no"; then

dnl Solaris 2.8 claims to be 2004 API, but doesn't have ldap_parse_reference()
dnl nor ldap_start_tls_s()
AC_CHECK_FUNCS(m4_normalize([
AC_CHECK_FUNCS([
ldap_control_find
ldap_extended_operation_s
ldap_parse_extended_result
Expand All @@ -142,7 +142,7 @@ if test "$PHP_LDAP" != "no"; then
ldap_refresh_s
ldap_start_tls_s
ldap_whoami_s
]))
])

dnl Sanity check
AC_CHECK_FUNC([ldap_sasl_bind_s],,
Expand Down
5 changes: 5 additions & 0 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,11 @@ static zend_property_info* zend_get_known_property_info(const zend_op_array *op_
}

if (info->flags & ZEND_ACC_PUBLIC) {
if ((info->flags & ZEND_ACC_CHANGED)
&& op_array->scope
&& op_array->scope != ce) {
return NULL;
}
return info;
} else if (on_this) {
if (ce == info->ce) {
Expand Down
Loading