Skip to content

Commit d9346b5

Browse files
author
Mark Randall
committed
Merge remote-tracking branch 'origin/master' into undefined-var-alerts
2 parents 039885e + 2a8cecd commit d9346b5

File tree

74 files changed

+1158
-289
lines changed

Some content is hidden

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

74 files changed

+1158
-289
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ PHP NEWS
4040
- JSON:
4141
. Added json_validate(). (Juan Morales)
4242

43+
- MBString:
44+
. mb_detect_encoding is better able to identify the correct encoding for Turkish text. (Alex Dowad)
45+
4346
- Opcache:
4447
. Added start, restart and force restart time to opcache's
4548
phpinfo section. (Mikhail Galanin)
@@ -70,6 +73,8 @@ PHP NEWS
7073
over socket binding for a cpu core. (David Carlier)
7174
. Added SKF_AD_QUEUE for cbpf filters. (David Carlier)
7275
. Added socket_atmark if send/recv needs using MSG_OOB. (David Carlier)
76+
. Added TCP_QUICKACK constant, to give tigher control over
77+
ACK delays. (David Carlier)
7378

7479
- Standard:
7580
. E_NOTICEs emitted by unserialize() have been promoted to E_WARNING. (timwolla)

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ PHP 8.3 UPGRADE NOTES
105105

106106
- Sockets:
107107
. SO_ATTACH_REUSEPORT_CBPF (Linux only).
108+
. TCP_QUICKACK (Linux only).
108109

109110
========================================
110111
11. Changes to INI File Handling

Zend/Optimizer/block_pass.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
256256
}
257257
break;
258258

259+
case ZEND_MATCH_ERROR:
260+
if (opline->op1_type == IS_TMP_VAR) {
261+
src = VAR_SOURCE(opline->op1);
262+
VAR_SOURCE(opline->op1) = NULL;
263+
}
264+
break;
265+
259266
case ZEND_FREE:
260267
if (opline->op1_type == IS_TMP_VAR) {
261268
src = VAR_SOURCE(opline->op1);

Zend/tests/class_constants_007.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Ownership of constant expression inhereted from immutable class should be transfered to class
3+
--FILE--
4+
<?php
5+
class A {
6+
const X = ' ' . self::Y;
7+
const Y = ' ';
8+
}
9+
eval('class B extends A{}');
10+
var_dump(B::X);
11+
?>
12+
--EXPECT--
13+
string(2) " "

Zend/tests/gh10072-2.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-10072 (PHP crashes when execute_ex is overridden and a trampoline is used from internal code during shutdown)
3+
--EXTENSIONS--
4+
zend_test
5+
--INI--
6+
zend_test.replace_zend_execute_ex=1
7+
opcache.jit=disable
8+
--FILE--
9+
<?php
10+
11+
class TrampolineTest {
12+
public function __call(string $name, array $arguments) {
13+
echo 'Trampoline for ', $name, PHP_EOL;
14+
}
15+
}
16+
17+
register_shutdown_function([new TrampolineTest(), 'shutdown']);
18+
?>
19+
--EXPECT--
20+
Trampoline for shutdown

Zend/tests/gh10072.phpt

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
--TEST--
2+
GH-10072 (PHP crashes when execute_ex is overridden and a trampoline is used from internal code)
3+
--EXTENSIONS--
4+
zend_test
5+
--INI--
6+
zend_test.replace_zend_execute_ex=1
7+
opcache.jit=disable
8+
--FILE--
9+
<?php
10+
class DummyStreamWrapper
11+
{
12+
/** @var resource|null */
13+
public $context;
14+
15+
/** @var resource|null */
16+
public $handle;
17+
18+
19+
public function stream_cast(int $castAs)
20+
{
21+
return $this->handle;
22+
}
23+
24+
25+
public function stream_close(): void
26+
{
27+
}
28+
29+
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
30+
{
31+
return true;
32+
}
33+
34+
35+
public function stream_read(int $count)
36+
{
37+
return 0;
38+
}
39+
40+
41+
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
42+
{
43+
return true;
44+
}
45+
46+
47+
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
48+
{
49+
return false;
50+
}
51+
52+
53+
public function stream_stat()
54+
{
55+
return [];
56+
}
57+
58+
59+
public function stream_tell()
60+
{
61+
return [];
62+
}
63+
64+
65+
public function stream_truncate(int $newSize): bool
66+
{
67+
return true;
68+
}
69+
70+
71+
public function stream_write(string $data)
72+
{
73+
}
74+
75+
76+
public function unlink(string $path): bool
77+
{
78+
return false;
79+
}
80+
}
81+
82+
class TrampolineTest {
83+
/** @var resource|null */
84+
public $context;
85+
86+
/** @var object|null */
87+
private $wrapper;
88+
89+
public function __call(string $name, array $arguments) {
90+
if (!$this->wrapper) {
91+
$this->wrapper = new DummyStreamWrapper();
92+
}
93+
echo 'Trampoline for ', $name, PHP_EOL;
94+
return $this->wrapper->$name(...$arguments);
95+
}
96+
97+
}
98+
99+
stream_wrapper_register('custom', TrampolineTest::class);
100+
101+
102+
$fp = fopen("custom://myvar", "r+");
103+
?>
104+
--EXPECT--
105+
Trampoline for stream_open
106+
Trampoline for stream_close

Zend/tests/gh10200.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-10200 (zif_get_object_vars: Assertion `!(((__ht)->u.flags & (1<<2)) != 0)' failed.)
3+
--FILE--
4+
<?php
5+
6+
$xmlData = <<<EOF
7+
<?xml version="1.0" encoding="utf-8"?>
8+
<document>https://github.com/php/php-src/issues/10200 not encountered</document>
9+
EOF;
10+
11+
$xml = simplexml_load_string($xmlData);
12+
$output = get_object_vars($xml);
13+
var_dump($output);
14+
15+
?>
16+
--EXPECT--
17+
array(1) {
18+
[0]=>
19+
string(59) "https://github.com/php/php-src/issues/10200 not encountered"
20+
}

Zend/tests/stack_limit/stack_limit_001.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Stack limit 001 - Stack limit checks with max_allowed_stack_size detection
3+
--SKIPIF--
4+
<?php
5+
if (getenv('SKIP_MSAN')) die("skip msan requires a considerably higher zend.reserved_stack_size due to instrumentation");
6+
?>
37
--EXTENSIONS--
48
zend_test
59
--INI--

Zend/tests/stack_limit/stack_limit_002.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Stack limit 002 - Stack limit checks with max_allowed_stack_size detection (fibers)
3+
--SKIPIF--
4+
<?php
5+
if (getenv('SKIP_MSAN')) die("skip msan requires a considerably higher zend.reserved_stack_size due to instrumentation");
6+
?>
37
--EXTENSIONS--
48
zend_test
59
--INI--

Zend/tests/stack_limit/stack_limit_006.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Stack limit 006 - env size affects __libc_stack_end
3+
--SKIPIF--
4+
<?php
5+
if (getenv('SKIP_MSAN')) die("skip msan requires a considerably higher zend.reserved_stack_size due to instrumentation");
6+
?>
37
--EXTENSIONS--
48
zend_test
59
--INI--

Zend/tests/stack_limit/stack_limit_009.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Stack limit 009 - Check that we can actually use all the stack
3+
--SKIPIF--
4+
<?php
5+
if (getenv('SKIP_MSAN')) die("skip msan requires a considerably higher zend.reserved_stack_size due to instrumentation");
6+
?>
37
--EXTENSIONS--
48
zend_test
59
--FILE--

Zend/tests/traits/constant_016.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Compatibility of values of same name trait constants is checked after their constant expressions are evaluated
33
--ENV--
44
ENSURE_CONSTANT_IS_DEFINED_AT_RUNTIME=1
5+
--INI--
6+
variables_order=EGPCS
57
--FILE--
68
<?php
79

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
136136
case IS_MIXED:
137137
return "mixed";
138138
case _IS_NUMBER:
139-
return "number";
139+
return "int|float";
140140
EMPTY_SWITCH_DEFAULT_CASE()
141141
}
142142
}

Zend/zend_ast.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ ZEND_API zend_ast *zend_ast_create_decl(
121121
ast->start_lineno = start_lineno;
122122
ast->end_lineno = CG(zend_lineno);
123123
ast->flags = flags;
124-
ast->lex_pos = LANG_SCNG(yy_text);
125124
ast->doc_comment = doc_comment;
126125
ast->name = name;
127126
ast->child[0] = child0;

Zend/zend_ast.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ typedef struct _zend_ast_decl {
208208
uint32_t start_lineno;
209209
uint32_t end_lineno;
210210
uint32_t flags;
211-
unsigned char *lex_pos;
212211
zend_string *doc_comment;
213212
zend_string *name;
214213
zend_ast *child[5];

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ ZEND_FUNCTION(get_object_vars)
764764
} else {
765765
array_init_size(return_value, zend_hash_num_elements(properties));
766766

767-
ZEND_HASH_MAP_FOREACH_KEY_VAL(properties, num_key, key, value) {
767+
ZEND_HASH_FOREACH_KEY_VAL(properties, num_key, key, value) {
768768
bool is_dynamic = 1;
769769
if (Z_TYPE_P(value) == IS_INDIRECT) {
770770
value = Z_INDIRECT_P(value);

Zend/zend_inheritance.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ static void do_inherit_class_constant(zend_string *name, zend_class_constant *pa
13851385
c = zend_arena_alloc(&CG(arena), sizeof(zend_class_constant));
13861386
memcpy(c, parent_const, sizeof(zend_class_constant));
13871387
parent_const = c;
1388+
Z_CONSTANT_FLAGS(c->value) |= CONST_OWNED;
13881389
}
13891390
}
13901391
if (ce->type & ZEND_INTERNAL_CLASS) {

Zend/zend_language_parser.y

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,6 @@ inline_function:
12501250
T_DOUBLE_ARROW backup_fn_flags backup_lex_pos expr backup_fn_flags
12511251
{ $$ = zend_ast_create_decl(ZEND_AST_ARROW_FUNC, $2 | $12, $1, $3,
12521252
zend_string_init("{closure}", sizeof("{closure}") - 1, 0), $5, NULL, $11, $7, NULL);
1253-
((zend_ast_decl *) $$)->lex_pos = $10;
12541253
CG(extra_fn_flags) = $9; }
12551254
;
12561255

Zend/zend_vm_def.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8745,7 +8745,9 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY, SPEC(OBSERVER))
87458745
SAVE_OPLINE_EX();
87468746
ZEND_OBSERVER_FCALL_BEGIN(execute_data);
87478747
execute_data = EX(prev_execute_data);
8748-
LOAD_OPLINE();
8748+
if (execute_data) {
8749+
LOAD_OPLINE();
8750+
}
87498751
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
87508752
zend_execute_ex(call);
87518753
}
@@ -8797,7 +8799,7 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY, SPEC(OBSERVER))
87978799

87988800
execute_data = EG(current_execute_data);
87998801

8800-
if (!EX(func) || !ZEND_USER_CODE(EX(func)->type) || (call_info & ZEND_CALL_TOP)) {
8802+
if (!execute_data || !EX(func) || !ZEND_USER_CODE(EX(func)->type) || (call_info & ZEND_CALL_TOP)) {
88018803
ZEND_VM_RETURN();
88028804
}
88038805

Zend/zend_vm_execute.h

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)