Skip to content

Commit 394f652

Browse files
committed
Merge branch 'master' into offline-http-tests
* master: (26 commits) Fix usage of optimize attribute on unsupported compilers (GH-21819) PHP 8.4 is now for PHP 8.4.22-dev ext/phar: remove `phar_archive_data->alias == phar_archive_data->fname` checks (#21820) [skip ci] Mark curl/bug71523.phpt as online test [skip ci] Sort paths-ignore and remove cirrus [skip ci] Tweak paths-ignore ext/standard: Throw a ValueError when the parameter includes NUL bytes in `putenv` and `getenv` (#21817) ext/session: fix missing zval_ptr_dtor for retval in PS_GC_FUNC(user) [skip ci] Backport CI changes ext/gmp: reject values larger than unsigned long in gmp_pow/binomial/root/rootrem and shift/pow operators. Update NEWS for recent bug fixes ext/phar: Fix memory leak in phar_verify_signature() when md_ctx is invalid phar: propagate phar_stream_flush return value from phar_stream_close phar: call phar_entry_delref before goto finish in phar_add_file error paths phar: free is_temp_dir entry before rejecting .phar/* paths in offsetGet phar: fix NULL dereference in Phar::webPhar() when SCRIPT_NAME is absent phar: restore is_link handler in phar_intercept_functions_shutdown ext/session: improve parsing of session.cookie_lifetime (#21704) /ext/standard: Check for empty string in linkinfo() (#21793) [Windows] Improve clang-cl support (#21618) ...
2 parents 261bb47 + 355571c commit 394f652

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+651
-176
lines changed

.github/matrix.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,15 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re
144144
$jobs['SOLARIS'] = true;
145145
}
146146
if ($all_jobs || !$no_jobs || $test_windows) {
147-
$jobs['WINDOWS']['matrix'] = $all_variations
148-
? ['include' => [
149-
['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true],
150-
['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false],
151-
]]
152-
: ['include' => [['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true]]];
147+
$matrix = [['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true]];
148+
if ($all_variations) {
149+
$matrix[] = ['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true];
150+
$matrix[] = ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false];
151+
if (version_compare($php_version, '8.5', '>=')) {
152+
$matrix[] = ['asan' => false, 'opcache' => true, 'x64' => true, 'zts' => true, 'clang' => true];
153+
}
154+
}
155+
$jobs['WINDOWS']['matrix'] = ['include' => $matrix];
153156
$jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=')
154157
? ['vs_crt_version' => 'vs17']
155158
: ['vs_crt_version' => 'vs16'];

.github/scripts/windows/build_task.bat

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ if %errorlevel% neq 0 exit /b 3
2626
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
2727
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
2828
if "%ASAN%" equ "1" set ADD_CONF=%ADD_CONF% --enable-sanitizer --enable-debug-pack
29+
if "%CLANG_TOOLSET%" equ "1" set ADD_CONF=%ADD_CONF% --with-toolset=clang
2930

3031
rem C4018: comparison: signed/unsigned mismatch
3132
rem C4146: unary minus operator applied to unsigned type
3233
rem C4244: type conversion, possible loss of data
3334
rem C4267: 'size_t' type conversion, possible loss of data
34-
set CFLAGS=/W3 /WX /wd4018 /wd4146 /wd4244 /wd4267
35+
if "%CLANG_TOOLSET%" equ "1" (
36+
rem Clang is much stricter than MSVC, produces too many warnings that would fail the build with /WX
37+
set CFLAGS=/W3 /wd4018 /wd4146 /wd4244 /wd4267
38+
) else (
39+
set CFLAGS=/W3 /WX /wd4018 /wd4146 /wd4244 /wd4267
40+
)
3541

3642
cmd /c configure.bat ^
3743
--enable-snapshot-build ^

.github/workflows/test-suite.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ jobs:
940940
strategy:
941941
fail-fast: false
942942
matrix: ${{ fromJson(inputs.branch).jobs.WINDOWS.matrix }}
943-
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}"
943+
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || ''}}${{ matrix.clang && '_CLANG' || ''}}"
944944
runs-on: windows-2022
945945
env:
946946
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
@@ -954,6 +954,7 @@ jobs:
954954
PARALLEL: -j2
955955
OPCACHE: "${{ matrix.opcache && '1' || '0' }}"
956956
ASAN: "${{ matrix.asan && '1' || '0' }}"
957+
CLANG_TOOLSET: "${{ matrix.clang && '1' || '0' }}"
957958
steps:
958959
- name: git config
959960
run: git config --global core.autocrlf false && git config --global core.eol lf

.github/workflows/test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ name: Test
22
on:
33
push:
44
paths-ignore: &ignore_paths
5+
- .circleci/**
6+
- .github/CODEOWNERS
7+
- .github/ISSUE_TEMPLATE/**
8+
- '**/*.md'
9+
- '**/*.rst'
510
- docs/**
11+
- EXTENSIONS
12+
- LICENSE
613
- NEWS
714
- UPGRADING
815
- UPGRADING.INTERNALS
9-
- '**/README.*'
10-
- CONTRIBUTING.md
11-
- CODING_STANDARDS.md
12-
- .cirrus.yml
13-
- .circleci/**
1416
branches:
1517
- PHP-8.2
1618
- PHP-8.3

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ PHP NEWS
2626
- DOM:
2727
. Removed LIBXML_XINCLUDE from valid options for XMLDocument,
2828
as it was a no-op. (ndossche)
29+
. Readonly DOM properties are now declared with asymmetric visibility
30+
(public private(set)). ReflectionProperty::isWritable() reports them
31+
correctly, and external writes raise "Cannot modify private(set)
32+
property" instead of the previous readonly modification error.
33+
(David Carlier)
2934

3035
- Fileinfo:
3136
. Fixed bug GH-20679 (finfo_file() doesn't work on remote resources).
@@ -38,6 +43,8 @@ PHP NEWS
3843

3944
- GMP:
4045
. gmp_fact() reject values larger than unsigned long. (David Carlier)
46+
. gmp_pow/binomial/root/rootrem and shift/pow operators reject values
47+
larger than unsigned long. (David Carlier)
4148

4249
- Hash:
4350
. Upgrade xxHash to 0.8.2. (timwolla)
@@ -161,6 +168,10 @@ PHP NEWS
161168
throw a ValueError. (alexandre-daubois)
162169
. array_change_key_case() now raises a ValueError when an invalid $case
163170
argument value is passed. (Girgias)
171+
. linkinfo() now raises a ValueError when the argument is an empty string.
172+
(Weilin Du)
173+
. getenv() and putenv() now raises a ValueError when the first argument
174+
contains null bytes. (Weilin Du)
164175

165176
- Streams:
166177
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream

TSRM/TSRM.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,14 @@ TSRM_API bool tsrm_is_managed_thread(void);
175175
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
176176
#define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element)
177177
#define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset)))
178+
#ifdef __cplusplus
179+
#define TSRMLS_MAIN_CACHE_EXTERN() extern "C" { extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR; }
180+
#define TSRMLS_CACHE_EXTERN() extern "C" { extern TSRM_TLS void *TSRMLS_CACHE; }
181+
#else
178182
#define TSRMLS_MAIN_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
179-
#define TSRMLS_MAIN_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
180183
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
184+
#endif
185+
#define TSRMLS_MAIN_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
181186
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
182187
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
183188
#define TSRMLS_CACHE _tsrm_ls_cache

UPGRADING

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ PHP 8.6 UPGRADE NOTES
1919
1. Backward Incompatible Changes
2020
========================================
2121

22+
- DOM:
23+
. Properties previously documented as @readonly (e.g. DOMNode::$nodeType,
24+
DOMDocument::$xmlEncoding, DOMEntity::$actualEncoding, ::$encoding,
25+
::$version) are now declared with asymmetric visibility
26+
(public private(set)). Attempts to write to them from outside the
27+
class now raise "Cannot modify private(set) property <class>::$<prop>
28+
from global scope" instead of the prior readonly modification error.
29+
ReflectionProperty::isWritable() also reports these properties
30+
accurately.
31+
2232
- GD:
2333
. imagesetstyle(), imagefilter() and imagecrop() filter their
2434
array arguments types/values and raise a TypeError/ValueError
@@ -78,6 +88,9 @@ PHP 8.6 UPGRADE NOTES
7888
argument value is passed.
7989
. array_change_key_case() now raises a ValueError when an invalid $case
8090
argument value is passed.
91+
. getenv() and putenv() now raises a ValueError when the first argument
92+
contains null bytes.
93+
. linkinfo() now raises a ValueError when the $path argument is empty.
8194
. pathinfo() now raises a ValueError when an invalid $flag
8295
argument value is passed.
8396
. scandir() now raises a ValueError when an invalid $sorting_order
@@ -144,6 +157,13 @@ PHP 8.6 UPGRADE NOTES
144157
- GMP:
145158
. gmp_fact() now throws a ValueError() if $num does not fit into
146159
a unsigned long.
160+
. gmp_pow(), gmp_binomial(), gmp_root() and gmp_rootrem() now throw a
161+
ValueError if their second argument does not fit into an unsigned long.
162+
. The shift (<<, >>) and exponentiation (**) operators on GMP objects
163+
now throw a ValueError if the right operand does not fit into an
164+
unsigned long.
165+
. gmp_powm() modulo-by-zero now raises a DivisionByZeroError whose
166+
message includes the function name and argument index ($modulus).
147167

148168
- mysqli:
149169
. The return structure of mysqli_get_charset() no longer contains

Zend/tests/enum/gh21760.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-21760 (Trait with class constant name conflict against enum case causes SEGV)
3+
--FILE--
4+
<?php
5+
6+
trait X {
7+
public const Up = 1;
8+
}
9+
10+
enum Direction {
11+
use X;
12+
13+
case Up;
14+
case Down;
15+
}
16+
17+
?>
18+
--EXPECTF--
19+
Fatal error: Cannot use trait X, because X::Up conflicts with enum case Direction::Up in %s on line %d

Zend/zend_cpuinfo.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ static zend_always_inline int zend_cpu_supports_avx512_vbmi(void) {
271271
}
272272
#endif
273273

274-
/* __builtin_cpu_supports has pclmul from gcc9 */
275-
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (!defined(__GNUC__) || (ZEND_GCC_VERSION >= 9000))
274+
/* __builtin_cpu_supports has pclmul from gcc9 and clang 19 */
275+
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000))
276276
ZEND_NO_SANITIZE_ADDRESS
277277
static inline int zend_cpu_supports_pclmul(void) {
278278
#ifdef PHP_HAVE_BUILTIN_CPU_INIT
@@ -286,8 +286,9 @@ static inline int zend_cpu_supports_pclmul(void) {
286286
}
287287
#endif
288288

289-
/* __builtin_cpu_supports has cldemote from gcc11 */
290-
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)
289+
/* __builtin_cpu_supports has cldemote from gcc11 and clang 19 */
290+
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && ((defined(__clang__) && (__clang_major__ >= 19)) || (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)))
291+
#define HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE 1
291292
ZEND_NO_SANITIZE_ADDRESS
292293
static inline int zend_cpu_supports_cldemote(void) {
293294
#ifdef PHP_HAVE_BUILTIN_CPU_INIT

Zend/zend_inheritance.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,19 @@ static void emit_incompatible_trait_constant_error(
27652765
);
27662766
}
27672767

2768+
static void emit_trait_constant_enum_case_conflict_error(
2769+
const zend_class_entry *ce, const zend_class_constant *trait_constant, zend_string *name
2770+
) {
2771+
zend_error_noreturn(E_COMPILE_ERROR,
2772+
"Cannot use trait %s, because %s::%s conflicts with enum case %s::%s",
2773+
ZSTR_VAL(trait_constant->ce->name),
2774+
ZSTR_VAL(trait_constant->ce->name),
2775+
ZSTR_VAL(name),
2776+
ZSTR_VAL(ce->name),
2777+
ZSTR_VAL(name)
2778+
);
2779+
}
2780+
27682781
static bool do_trait_constant_check(
27692782
zend_class_entry *ce, zend_class_constant *trait_constant, zend_string *name, zend_class_entry **traits, size_t current_trait
27702783
) {
@@ -2778,6 +2791,11 @@ static bool do_trait_constant_check(
27782791

27792792
zend_class_constant *existing_constant = Z_PTR_P(zv);
27802793

2794+
if (UNEXPECTED(ZEND_CLASS_CONST_FLAGS(existing_constant) & ZEND_CLASS_CONST_IS_CASE)) {
2795+
emit_trait_constant_enum_case_conflict_error(ce, trait_constant, name);
2796+
return false;
2797+
}
2798+
27812799
if ((ZEND_CLASS_CONST_FLAGS(trait_constant) & flags_mask) != (ZEND_CLASS_CONST_FLAGS(existing_constant) & flags_mask)) {
27822800
emit_incompatible_trait_constant_error(ce, existing_constant, trait_constant, name, traits, current_trait);
27832801
return false;

0 commit comments

Comments
 (0)