Skip to content

Commit 89bff66

Browse files
committed
Merge remote-tracking branch 'upstream/master' into upstream_rfc/scoped_rng_for_pr
2 parents 196499e + 0dbedb3 commit 89bff66

File tree

120 files changed

+3968
-1298
lines changed

Some content is hidden

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

120 files changed

+3968
-1298
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ end_of_line = lf
99
charset = utf-8
1010
tab_width = 4
1111

12-
[{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}]
12+
[{*.{awk,bat,c,cpp,d,dasc,h,l,re,skl,w32,y},Makefile*}]
1313
indent_size = 4
1414
indent_style = tab
1515

NEWS

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,38 @@ PHP NEWS
44

55
- CLI:
66
. Updated the mime-type table for the builtin-server. (Ayesh Karunaratne)
7-
. Fixed potential overflow for the builtin server via the PHP_CLI_SERVER_WORKERS
8-
environment variable. (yiyuaner)
7+
. Fixed potential overflow for the builtin server via the
8+
PHP_CLI_SERVER_WORKERS environment variable. (yiyuaner)
9+
. Fixed GH-8575 by changing STDOUT, STDERR and STDIN to not close on resource
10+
destruction. (Jakub Zelenka)
911

1012
- Core:
1113
. Reduced the memory footprint of strings returned by var_export(),
1214
json_encode(), serialize(), iconv_*(), mb_ereg*(), session_create_id(),
1315
http_build_query(), strstr(), Reflection*::__toString(). (Arnaud)
1416
. Fixed bug GH-8995 (WeakMap object reference offset causing TypeError).
1517
(Tobias Bachert)
18+
. Added error_log_mode ini setting. (Mikhail Galanin)
19+
. Updated request startup messages. (Eric Norris)
1620

1721
- COM:
1822
. Fixed bug GH-8750 (Can not create VT_ERROR variant type). (cmb)
1923

24+
- Filter:
25+
. Added FILTER_FLAG_GLOBAL_RANGE to filter Global IPs. (vnsavage)
26+
2027
- FPM:
2128
. Added listen.setfib pool option to set route FIB on FreeBSD. (David Carlier)
2229
. Added access.suppress_path pool option to filter access log entries.
2330
(Mark Gallagher)
31+
. Fixed on fpm scoreboard occasional warning on acquisition failure.
32+
(Felix Wiedemann)
33+
34+
- Opcache:
35+
. Added initial support for JIT performance profiling generation
36+
for macOs Instrument. (David Carlier)
37+
. Fixed bug GH-8030 (Segfault with JIT and large match/switch statements).
38+
(Arnaud)
2439

2540
- PCRE:
2641
. Updated bundled libpcre to 10.40. (cmb)

UPGRADING

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ PHP 8.2 UPGRADE NOTES
7474
RFC: https://wiki.php.net/rfc/readonly_classes
7575
. Added support for true type.
7676
RFC: https://wiki.php.net/rfc/true-type
77+
. Added support for Disjoint Normal Form (DNF) types.
78+
RFC: https://wiki.php.net/rfc/dnf_types
79+
. Added error_log_mode ini setting that allows setting of permissions for
80+
error log file.
81+
. Added support for fetching properties of enums in constant expressions.
82+
RFC: https://wiki.php.net/rfc/fetch_property_in_const_expressions
7783

7884

7985
- Curl:
@@ -345,6 +351,9 @@ PHP 8.2 UPGRADE NOTES
345351
. CURL_VERSION_UNICODE (libcurl >= 7.72.0)
346352
. CURL_VERSION_ZSTD (libcurl >= 7.72.0)
347353

354+
- Filter
355+
. FILTER_FLAG_GLOBAL_RANGE
356+
348357
- Sockets:
349358
. SO_INCOMING_CPU
350359
. SO_MEMINFO
@@ -473,6 +482,11 @@ PHP 8.2 UPGRADE NOTES
473482
13. Other Changes
474483
========================================
475484

485+
- CLI:
486+
. The STDOUT, STDERR and STDIN are no longer closed on resource destruction
487+
which is mostly when the CLI finishes. It is however still possible to
488+
explicitly close those streams using fclose and similar.
489+
476490
- Core:
477491
. The iterable type is now a built-in compile time alias for array|Traversable.
478492
Error messages relating to iterable will therefore now use array|Traversable.

Zend/Optimizer/zend_inference.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,9 @@ static uint32_t assign_dim_array_result_type(
19611961
value_type |= MAY_BE_NULL;
19621962
}
19631963
if (dim_op_type == IS_UNUSED) {
1964+
if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
1965+
tmp |= MAY_BE_ARRAY_PACKED;
1966+
}
19641967
tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG;
19651968
} else {
19661969
if (dim_type & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
@@ -3377,7 +3380,12 @@ static zend_always_inline zend_result _zend_update_type_info(
33773380
ZEND_ASSERT(j < 0 && "There should only be one use");
33783381
}
33793382
}
3380-
if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY)) || opline->opcode == ZEND_FETCH_DIM_FUNC_ARG) {
3383+
if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY))
3384+
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
3385+
|| opline->opcode == ZEND_FETCH_DIM_R
3386+
|| opline->opcode == ZEND_FETCH_DIM_IS
3387+
|| opline->opcode == ZEND_FETCH_DIM_UNSET
3388+
|| opline->opcode == ZEND_FETCH_LIST_R) {
33813389
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
33823390
} else {
33833391
/* invalid key type */

Zend/tests/fibers/signal-async.phpt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--TEST--
2+
Prevent switching fibers when async signals are enabled
3+
--EXTENSIONS--
4+
pcntl
5+
posix
6+
--FILE--
7+
<?php
8+
9+
pcntl_async_signals(true);
10+
11+
pcntl_signal(SIGUSR1, function (): void {
12+
if (Fiber::getCurrent() !== null) {
13+
Fiber::suspend();
14+
}
15+
});
16+
17+
$fiber = new Fiber(function (): void {
18+
echo "Fiber start\n";
19+
posix_kill(posix_getpid(), SIGUSR1);
20+
time_nanosleep(1);
21+
echo "Fiber end\n";
22+
});
23+
24+
$fiber->start();
25+
26+
?>
27+
--EXPECTF--
28+
Fiber start
29+
30+
Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %ssignal-async.php:%d
31+
Stack trace:
32+
#0 %ssignal-async.php(%d): Fiber::suspend()
33+
#1 %ssignal-async.php(%d): {closure}(%d, Array)
34+
#2 [internal function]: {closure}()
35+
#3 %ssignal-async.php(%d): Fiber->start()
36+
#4 {main}
37+
thrown in %ssignal-async.php on line %d
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--TEST--
2+
Prevent switching fibers when dispatching pending signals
3+
--EXTENSIONS--
4+
pcntl
5+
posix
6+
--FILE--
7+
<?php
8+
9+
pcntl_signal(SIGUSR1, function (): void {
10+
if (Fiber::getCurrent() !== null) {
11+
Fiber::suspend();
12+
}
13+
});
14+
15+
$fiber = new Fiber(function (): void {
16+
echo "Fiber start\n";
17+
18+
posix_kill(posix_getpid(), SIGUSR1);
19+
20+
try {
21+
pcntl_signal_dispatch();
22+
} catch (FiberError $e) {
23+
Fiber::suspend($e);
24+
}
25+
26+
echo "Fiber end\n";
27+
});
28+
29+
$e = $fiber->start();
30+
31+
echo $e, "\n";
32+
33+
$fiber->resume();
34+
35+
?>
36+
--EXPECTF--
37+
Fiber start
38+
FiberError: Cannot switch fibers in current execution context in %ssignal-dispatch.php:%d
39+
Stack trace:
40+
#0 %ssignal-dispatch.php(%d): Fiber::suspend()
41+
#1 [internal function]: {closure}(%d, Array)
42+
#2 %ssignal-dispatch.php(%d): pcntl_signal_dispatch()
43+
#3 [internal function]: {closure}()
44+
#4 %ssignal-dispatch.php(%d): Fiber->start()
45+
#5 {main}
46+
Fiber end

Zend/tests/fibers/ticks.phpt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Prevent switching fibers in tick function
3+
--FILE--
4+
<?php
5+
6+
declare(ticks=1);
7+
8+
register_tick_function(function (): void {
9+
if (Fiber::getCurrent() !== null) {
10+
Fiber::suspend();
11+
}
12+
});
13+
14+
$fiber = new Fiber(function (): void {
15+
echo "1\n";
16+
echo "2\n";
17+
echo "3\n";
18+
});
19+
20+
$fiber->start();
21+
22+
?>
23+
--EXPECTF--
24+
1
25+
26+
Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %sticks.php:%d
27+
Stack trace:
28+
#0 %sticks.php(%d): Fiber::suspend()
29+
#1 %sticks.php(%d): {closure}()
30+
#2 [internal function]: {closure}()
31+
#3 %sticks.php(%d): Fiber->start()
32+
#4 {main}
33+
thrown in %sticks.php on line %d
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
Allow fetching properties in attributes
3+
--EXTENSIONS--
4+
reflection
5+
--FILE--
6+
<?php
7+
8+
enum A: string {
9+
case B = 'C';
10+
}
11+
12+
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
13+
class Attr {
14+
public function __construct(public $value) {}
15+
}
16+
17+
#[Attr(A::B->name)]
18+
#[Attr(A::B->value)]
19+
#[Attr(A::B?->name)]
20+
#[Attr(A::B?->value)]
21+
class C {}
22+
23+
foreach ((new ReflectionClass(C::class))->getAttributes() as $reflectionAttribute) {
24+
var_dump($reflectionAttribute->newInstance());
25+
}
26+
27+
?>
28+
--EXPECT--
29+
object(Attr)#1 (1) {
30+
["value"]=>
31+
string(1) "B"
32+
}
33+
object(Attr)#1 (1) {
34+
["value"]=>
35+
string(1) "C"
36+
}
37+
object(Attr)#1 (1) {
38+
["value"]=>
39+
string(1) "B"
40+
}
41+
object(Attr)#1 (1) {
42+
["value"]=>
43+
string(1) "C"
44+
}

Zend/tests/prop_const_expr/basic.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Allow fetching properties in constant expressions on enums
3+
--FILE--
4+
<?php
5+
6+
enum A: string {
7+
case Case = 'A::Case';
8+
}
9+
10+
const A_name = A::Case->name;
11+
const A_value = A::Case->value;
12+
13+
var_dump(A_name);
14+
var_dump(A_value);
15+
16+
const A_name_nullsafe = A::Case?->name;
17+
const A_value_nullsafe = A::Case?->value;
18+
19+
var_dump(A_name_nullsafe);
20+
var_dump(A_value_nullsafe);
21+
22+
?>
23+
--EXPECT--
24+
string(4) "Case"
25+
string(7) "A::Case"
26+
string(4) "Case"
27+
string(7) "A::Case"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--TEST--
2+
Nullsafe property constant expression
3+
--FILE--
4+
<?php
5+
6+
class Printer {
7+
public function __construct() {
8+
echo "Printer\n";
9+
}
10+
}
11+
12+
const A = (null)?->test;
13+
var_dump(A);
14+
15+
const B = (null)?->test->test;
16+
var_dump(B);
17+
18+
const C = (null)->test?->test;
19+
var_dump(C);
20+
21+
const D = (null)?->test['test'];
22+
var_dump(D);
23+
24+
const E = (null)['test']?->test;
25+
var_dump(E);
26+
27+
const F = (null)?->{new Printer};
28+
var_dump(F);
29+
30+
const G = (null)?->test + (new Printer ? 1 : 0);
31+
var_dump(G);
32+
33+
?>
34+
--EXPECTF--
35+
NULL
36+
NULL
37+
38+
Warning: Attempt to read property "test" on null in %s on line %d
39+
NULL
40+
NULL
41+
42+
Warning: Trying to access array offset on value of type null in %s on line %d
43+
NULL
44+
NULL
45+
Printer
46+
int(1)

0 commit comments

Comments
 (0)