Skip to content

Commit 8d74bdd

Browse files
Merge remote-tracking branch 'source/master'
2 parents 0cf2c1b + ee2cec1 commit 8d74bdd

File tree

165 files changed

+5869
-2987
lines changed

Some content is hidden

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

165 files changed

+5869
-2987
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.0alpha1
4+
. Fixed bug #81390 (mb_detect_encoding() regression). (alexdowad)
45

56
- CLI:
67
. Fixed bug #81496 (Server logs incorrect request method). (lauri)

UPGRADING

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ PHP 8.2 UPGRADE NOTES
2727
. Added CURLINFO_EFFECTIVE_METHOD option and returning the effective
2828
HTTP method in curl_getinfo() return value.
2929

30+
- PCRE:
31+
. Added support for the "n" (NO_AUTO_CAPTURE) modifier, which makes simple
32+
`(xyz)` groups non-capturing. Only named groups like `(?<name>xyz)` are
33+
capturing. This only affects which groups are capturing, it is still
34+
possible to use numbered subpattern references, and the matches array will
35+
still contain numbered results.
36+
3037
========================================
3138
3. Changes in SAPI modules
3239
========================================
@@ -55,6 +62,16 @@ PHP 8.2 UPGRADE NOTES
5562

5663
RFC: https://wiki.php.net/rfc/deprecate_partially_supported_callables
5764

65+
- Mbstring:
66+
. Use of QPrint, Base64, Uuencode, and HTML-ENTITIES 'text encodings' is
67+
deprecated for all Mbstring functions. Unlike all the other text
68+
encodings supported by Mbstring, these do not encode a sequence of
69+
Unicode codepoints, but rather a sequence of raw bytes. It is not
70+
clear what the correct return values for most Mbstring functions should
71+
be when one of these non-encodings is specified. Further, PHP has
72+
separate, built-in implementations of all of them; for example, UUencoded
73+
data can be handled using convert_uuencode/convert_uudecode.
74+
5875
========================================
5976
5. Changed Functions
6077
========================================
@@ -85,12 +102,15 @@ PHP 8.2 UPGRADE NOTES
85102

86103
- Zip:
87104
. extension updated to 1.20.0 with new methods:
88-
ZipArchive::cleaError, getStreamName and getStreamIndex
105+
ZipArchive::clearError, getStreamName and getStreamIndex
89106

90107
========================================
91108
10. New Global Constants
92109
========================================
93110

111+
- COM_DOTNET:
112+
. LOCALE_NEUTRAL
113+
94114
========================================
95115
11. Changes to INI File Handling
96116
========================================
@@ -99,6 +119,10 @@ PHP 8.2 UPGRADE NOTES
99119
12. Windows Support
100120
========================================
101121

122+
- Core:
123+
. Windows specific error messages are no longer localized, but instead in
124+
English to better match PHP error messages.
125+
102126
========================================
103127
13. Other Changes
104128
========================================

Zend/Optimizer/sccp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ static inline zend_result ct_eval_in_array(zval *result, uint32_t extended_value
767767
zval key_tmp;
768768

769769
res = 0;
770-
ZEND_HASH_FOREACH_STR_KEY(ht, key) {
770+
ZEND_HASH_MAP_FOREACH_STR_KEY(ht, key) {
771771
ZVAL_STR(&key_tmp, key);
772772
if (zend_compare(op1, &key_tmp) == 0) {
773773
res = 1;

Zend/Optimizer/scdf.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,18 @@ static bool is_live_loop_var_free(
190190
return false;
191191
}
192192

193-
int ssa_var = ssa_op->op1_use;
194-
if (ssa_var < 0) {
193+
int var = ssa_op->op1_use;
194+
if (var < 0) {
195195
return false;
196196
}
197197

198-
int op_num = scdf->ssa->vars[ssa_var].definition;
199-
ZEND_ASSERT(op_num >= 0);
200-
uint32_t def_block = scdf->ssa->cfg.map[op_num];
198+
zend_ssa_var *ssa_var = &scdf->ssa->vars[var];
199+
uint32_t def_block;
200+
if (ssa_var->definition >= 0) {
201+
def_block = scdf->ssa->cfg.map[ssa_var->definition];
202+
} else {
203+
def_block = ssa_var->definition_phi->block;
204+
}
201205
return zend_bitset_in(scdf->executable_blocks, def_block);
202206
}
203207

Zend/Optimizer/zend_inference.c

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -655,35 +655,26 @@ static bool zend_inference_calc_binary_op_range(
655655
op2_min = OP2_MIN_RANGE();
656656
op1_max = OP1_MAX_RANGE();
657657
op2_max = OP2_MAX_RANGE();
658-
if (op2_min <= 0 && op2_max >= 0) {
659-
/* If op2 crosses zero, then floating point values close to zero might be
660-
* possible, which will result in arbitrarily large results. As such, we can't
661-
* do anything useful in that case. */
662-
break;
663-
}
664-
if (op1_min == ZEND_LONG_MIN && op2_max == -1) {
665-
/* Avoid ill-defined division, which may trigger SIGFPE. */
666-
break;
667-
}
668658

669-
zend_long t1_, t2_, t3_, t4_;
670-
float_div(op1_min, op2_min, &t1, &t1_);
671-
float_div(op1_min, op2_max, &t2, &t2_);
672-
float_div(op1_max, op2_min, &t3, &t3_);
673-
float_div(op1_max, op2_max, &t4, &t4_);
674-
675-
/* The only case in which division can "overflow" either a division by an absolute
676-
* value smaller than one, or LONG_MIN / -1 in particular. Both cases have already
677-
* been excluded above. */
678-
if (OP1_RANGE_UNDERFLOW() ||
679-
OP2_RANGE_UNDERFLOW() ||
680-
OP1_RANGE_OVERFLOW() ||
681-
OP2_RANGE_OVERFLOW()) {
659+
/* If op2 crosses zero, then floating point values close to zero might be
660+
* possible, which will result in arbitrarily large results (overflow). Also
661+
* avoid dividing LONG_MIN by -1, which is UB. */
662+
if (OP1_RANGE_UNDERFLOW() || OP2_RANGE_UNDERFLOW() ||
663+
OP1_RANGE_OVERFLOW() || OP2_RANGE_OVERFLOW() ||
664+
(op2_min <= 0 && op2_max >= 0) ||
665+
(op1_min == ZEND_LONG_MIN && op2_max == -1)
666+
) {
682667
tmp->underflow = 1;
683668
tmp->overflow = 1;
684669
tmp->min = ZEND_LONG_MIN;
685670
tmp->max = ZEND_LONG_MAX;
686671
} else {
672+
zend_long t1_, t2_, t3_, t4_;
673+
float_div(op1_min, op2_min, &t1, &t1_);
674+
float_div(op1_min, op2_max, &t2, &t2_);
675+
float_div(op1_max, op2_min, &t3, &t3_);
676+
float_div(op1_max, op2_max, &t4, &t4_);
677+
687678
tmp->min = MIN(MIN(MIN(t1, t2), MIN(t3, t4)), MIN(MIN(t1_, t2_), MIN(t3_, t4_)));
688679
tmp->max = MAX(MAX(MAX(t1, t2), MAX(t3, t4)), MAX(MAX(t1_, t2_), MAX(t3_, t4_)));
689680
}
@@ -3394,6 +3385,10 @@ static zend_always_inline zend_result _zend_update_type_info(
33943385
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
33953386
|| opline->opcode == ZEND_FETCH_LIST_W) {
33963387
j = ssa_vars[ssa_op->result_def].use_chain;
3388+
if (j < 0) {
3389+
/* no uses */
3390+
tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_NULL;
3391+
}
33973392
while (j >= 0) {
33983393
zend_uchar opcode;
33993394

@@ -3453,6 +3448,7 @@ static zend_always_inline zend_result _zend_update_type_info(
34533448
* is already an object. */
34543449
break;
34553450
case ZEND_SEND_VAR:
3451+
case ZEND_FETCH_DIM_R:
34563452
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
34573453
* behind, because it can't be converted to DIM_FETCH_R. */
34583454
break;
@@ -3679,7 +3675,9 @@ static zend_always_inline zend_result _zend_update_type_info(
36793675
tmp = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
36803676
if (opline->result_type == IS_TMP_VAR) {
36813677
if (opline->opcode == ZEND_FETCH_R || opline->opcode == ZEND_FETCH_IS) {
3682-
tmp |= MAY_BE_RCN;
3678+
/* Variable reference counter may be decremented before use */
3679+
/* See: ext/opcache/tests/jit/fetch_r_001.phpt */
3680+
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
36833681
} else {
36843682
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
36853683
}

Zend/Optimizer/zend_optimizer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,15 +1360,15 @@ void zend_foreach_op_array(zend_script *script, zend_op_array_func_t func, void
13601360

13611361
zend_foreach_op_array_helper(&script->main_op_array, func, context);
13621362

1363-
ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
1363+
ZEND_HASH_MAP_FOREACH_PTR(&script->function_table, op_array) {
13641364
zend_foreach_op_array_helper(op_array, func, context);
13651365
} ZEND_HASH_FOREACH_END();
13661366

1367-
ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
1367+
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
13681368
if (ce->refcount > 1 && !zend_string_equals_ci(key, ce->name)) {
13691369
continue;
13701370
}
1371-
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
1371+
ZEND_HASH_MAP_FOREACH_PTR(&ce->function_table, op_array) {
13721372
if (op_array->scope == ce
13731373
&& op_array->type == ZEND_USER_FUNCTION
13741374
&& !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
@@ -1516,11 +1516,11 @@ ZEND_API void zend_optimize_script(zend_script *script, zend_long optimization_l
15161516
}
15171517
}
15181518

1519-
ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
1519+
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
15201520
if (ce->refcount > 1 && !zend_string_equals_ci(key, ce->name)) {
15211521
continue;
15221522
}
1523-
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
1523+
ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
15241524
if (op_array->scope != ce && op_array->type == ZEND_USER_FUNCTION) {
15251525
zend_op_array *orig_op_array =
15261526
zend_hash_find_ptr(&op_array->scope->function_table, name);

0 commit comments

Comments
 (0)