Skip to content

Commit d5c69ed

Browse files
committed
Merge branch 'master' into packed_ht
* master: (378 commits) Removed debug code. JIT: Fixed use after free introduced in 92ad90a Inline "helper" macros Use zend_result as return value for DBA handler JIT: Avoid ZEND_CALL_RELEASE_THIS checks JIT_G(current_frame)->stacj is always true. JIT: Avoid dead type store [ci skip] Fix NEWS Fix #76167: mbstring may use pointer from some previous request Tracing JIT: Fixed possible endless loop when escape from ZEND_CALL_TOP frame Remove tests for obsolete Oracle DB version Remove test for obsolete Oracle DB version Fix tests for method camel case change Fix tests for method camel case change DBA should not convert elements in-place if the key param is an array Fix DBA on MacOS (php#7611) Refactor DBA Drop confusing ac local variable for ZEND_NUM_ARGS() Inline DBA_GET2 macro Inline DBA_ID_PARS macro ...
2 parents 6b1e401 + d2920df commit d5c69ed

File tree

505 files changed

+21057
-10708
lines changed

Some content is hidden

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

505 files changed

+21057
-10708
lines changed

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,15 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.0alpha1
44

5+
- CLI:
6+
. Fixed bug #81496 (Server logs incorrect request method). (lauri)
7+
8+
- Core:
9+
. Fixed bug #81380 (Observer may not be initialized properly). (krakjoe)
10+
11+
- Zip:
12+
. add ZipArchive::clearError() method
13+
. add ZipArchive::getStreamName() method
14+
. add ZipArchive::getStreamIndex() method
15+
516
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ contribute:
135135

136136
- [Contributing to PHP](/CONTRIBUTING.md)
137137
- [PHP coding standards](/CODING_STANDARDS.md)
138-
- [Mailinglist rules](/docs/mailinglist-rules.md)
138+
- [Mailing list rules](/docs/mailinglist-rules.md)
139139
- [PHP release process](/docs/release-process.md)
140140

141141
## Credits

UPGRADING

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ PHP 8.2 UPGRADE NOTES
2323
2. New Features
2424
========================================
2525

26+
- Curl:
27+
. Added CURLINFO_EFFECTIVE_METHOD option and returning the effective
28+
HTTP method in curl_getinfo() return value.
29+
2630
========================================
2731
3. Changes in SAPI modules
2832
========================================
@@ -31,10 +35,38 @@ PHP 8.2 UPGRADE NOTES
3135
4. Deprecated Functionality
3236
========================================
3337

38+
- Core:
39+
. Callables that are not accepted by the $callable() syntax (but are accepted
40+
by call_user_func) are deprecated. In particular:
41+
42+
"self::method"
43+
"parent::method"
44+
"static::method"
45+
["self", "method"]
46+
["parent", "method"]
47+
["static", "method"]
48+
["Foo", "Bar::method"]
49+
[new Foo, "Bar::method"]
50+
51+
This does not affect normal method callables like "A::method" or
52+
["A", "method"]. A deprecation notice is only emitted on call. Both
53+
is_callable() and the callable type will silently accept these callables
54+
until support for them is removed entirely.
55+
56+
RFC: https://wiki.php.net/rfc/deprecate_partially_supported_callables
57+
3458
========================================
3559
5. Changed Functions
3660
========================================
3761

62+
- DBA
63+
. dba_fetch()'s optional skip argument is now at the end in line with
64+
PHP userland semantics its signature now is:
65+
dba_fetch(string|array $key, $dba, int $skip = 0): string|false
66+
The overloaded signature
67+
dba_fetch(string|array $key, $skip, $dba): string|false
68+
is still accepted, but it is recommended to use the new standard variant.
69+
3870
========================================
3971
6. New Functions
4072
========================================
@@ -51,6 +83,10 @@ PHP 8.2 UPGRADE NOTES
5183
9. Other Changes to Extensions
5284
========================================
5385

86+
- Zip:
87+
. extension updated to 1.20.0 with new methods:
88+
ZipArchive::cleaError, getStreamName and getStreamIndex
89+
5490
========================================
5591
10. New Global Constants
5692
========================================

UPGRADING.INTERNALS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ PHP 8.2 INTERNALS UPGRADE NOTES
1010
1. Internal API changes
1111
========================
1212

13+
* Removed zend_binary_zval_str(n)casecmp() APIs. These were thin wrappers
14+
around zend_binary_str(n)casecmp_l() -- rather than
15+
zend_binary_str(n)casecmp() as one would expect. Call the appropriate
16+
wrapped function directly instead.
17+
* Removed the (ZEND_)WRONG_PARAM_COUNT_WITH_RETVAL() macros.
18+
1319
========================
1420
2. Build system changes
1521
========================

Zend/Optimizer/block_pass.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "zend_dump.h"
3131

3232
/* Checks if a constant (like "true") may be replaced by its value */
33-
int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy)
33+
bool zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy)
3434
{
3535
zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
3636
if (c) {
@@ -220,7 +220,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
220220
* Float to string conversion may be affected by current
221221
* locale setting.
222222
*/
223-
int l, old_len;
223+
size_t l, old_len;
224224

225225
if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
226226
convert_to_string(&ZEND_OP1_LITERAL(opline));
@@ -327,7 +327,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
327327
) {
328328
zval *arg = &OPLINE_OP1_LITERAL(sv);
329329
char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name;
330-
int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len;
330+
size_t flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len;
331331
if((flen == sizeof("function_exists")-1 && zend_binary_strcasecmp(fname, flen, "function_exists", sizeof("function_exists")-1) == 0) ||
332332
(flen == sizeof("is_callable")-1 && zend_binary_strcasecmp(fname, flen, "is_callable", sizeof("is_callable")-1) == 0)
333333
) {
@@ -341,7 +341,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
341341
}
342342
} else if(flen == sizeof("constant")-1 && zend_binary_strcasecmp(fname, flen, "constant", sizeof("constant")-1) == 0) {
343343
zval c;
344-
if(zend_optimizer_get_persistent_constant(Z_STR_P(arg), &c, 1 ELS_CC) != 0) {
344+
if (zend_optimizer_get_persistent_constant(Z_STR_P(arg), &c, 1 ELS_CC)) {
345345
literal_dtor(arg);
346346
MAKE_NOP(sv);
347347
MAKE_NOP(fcall);
@@ -712,7 +712,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
712712
src->opcode == ZEND_FAST_CONCAT) &&
713713
src->op2_type == IS_CONST) {
714714
/* compress consecutive CONCATs */
715-
int l, old_len;
715+
size_t l, old_len;
716716

717717
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
718718
convert_to_string(&ZEND_OP2_LITERAL(opline));
@@ -960,7 +960,6 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
960960
zend_op *new_opcodes;
961961
zend_op *opline;
962962
uint32_t len = 0;
963-
int n;
964963

965964
for (b = blocks; b < end; b++) {
966965
if (b->len == 0) {
@@ -1120,16 +1119,9 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
11201119
free_alloca(map, use_heap);
11211120
}
11221121

1123-
/* adjust early binding list */
1124-
if (op_array->fn_flags & ZEND_ACC_EARLY_BINDING) {
1125-
ZEND_ASSERT(op_array == &ctx->script->main_op_array);
1126-
ctx->script->first_early_binding_opline =
1127-
zend_build_delayed_early_binding_list(op_array);
1128-
}
1129-
11301122
/* rebuild map (just for printing) */
11311123
memset(cfg->map, -1, sizeof(int) * op_array->last);
1132-
for (n = 0; n < cfg->blocks_count; n++) {
1124+
for (int n = 0; n < cfg->blocks_count; n++) {
11331125
if (cfg->blocks[n].flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) {
11341126
cfg->map[cfg->blocks[n].start] = n;
11351127
}
@@ -1189,7 +1181,7 @@ static zend_always_inline zend_basic_block *get_next_block(const zend_cfg *cfg,
11891181

11901182

11911183
/* we use "jmp_hitlist" to avoid infinity loops during jmp optimization */
1192-
static zend_always_inline int in_hitlist(int target, int *jmp_hitlist, int jmp_hitlist_count)
1184+
static zend_always_inline bool in_hitlist(int target, int *jmp_hitlist, int jmp_hitlist_count)
11931185
{
11941186
int i;
11951187

@@ -1642,7 +1634,7 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
16421634
}
16431635

16441636
if (ctx->debug_level & ZEND_DUMP_BLOCK_PASS_VARS) {
1645-
int printed = 0;
1637+
bool printed = 0;
16461638
uint32_t i;
16471639

16481640
for (i = op_array->last_var; i< op_array->T; i++) {
@@ -1848,10 +1840,7 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
18481840

18491841
/* Build CFG */
18501842
checkpoint = zend_arena_checkpoint(ctx->arena);
1851-
if (zend_build_cfg(&ctx->arena, op_array, 0, &cfg) != SUCCESS) {
1852-
zend_arena_release(&ctx->arena, checkpoint);
1853-
return;
1854-
}
1843+
zend_build_cfg(&ctx->arena, op_array, 0, &cfg);
18551844

18561845
if (cfg.blocks_count * (op_array->last_var + op_array->T) > 64 * 1024 * 1024) {
18571846
zend_arena_release(&ctx->arena, checkpoint);
@@ -1892,6 +1881,15 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
18921881

18931882
/* Eliminate NOPs */
18941883
for (b = blocks; b < end; b++) {
1884+
if (b->flags & ZEND_BB_UNREACHABLE_FREE) {
1885+
/* In unreachable_free blocks only preserve loop var frees. */
1886+
for (uint32_t i = b->start; i < b->start + b->len; i++) {
1887+
zend_op *opline = &op_array->opcodes[i];
1888+
if (!zend_optimizer_is_loop_var_free(opline)) {
1889+
MAKE_NOP(opline);
1890+
}
1891+
}
1892+
}
18951893
if (b->flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) {
18961894
strip_nops(op_array, b);
18971895
}

Zend/Optimizer/compact_literals.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static uint32_t add_static_slot(HashTable *hash,
8888
uint32_t op1,
8989
uint32_t op2,
9090
uint32_t kind,
91-
int *cache_size)
91+
uint32_t *cache_size)
9292
{
9393
uint32_t ret;
9494
zval *class_name = &op_array->literals[op1];
@@ -150,7 +150,8 @@ static zend_string *create_str_cache_key(zval *literal, uint32_t flags)
150150
void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx)
151151
{
152152
zend_op *opline, *end;
153-
int i, j, n, *map, cache_size;
153+
int i, j, n, *map;
154+
uint32_t cache_size;
154155
zval zv, *pos;
155156
literal_info *info;
156157
int l_null = -1;

Zend/Optimizer/dce.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,7 @@ static bool try_remove_var_def(context *ctx, int free_var, int use_chain, zend_o
363363
case ZEND_PRE_INC:
364364
case ZEND_PRE_DEC:
365365
case ZEND_PRE_INC_OBJ:
366-
case ZEND_POST_INC_OBJ:
367366
case ZEND_PRE_DEC_OBJ:
368-
case ZEND_POST_DEC_OBJ:
369367
case ZEND_DO_ICALL:
370368
case ZEND_DO_UCALL:
371369
case ZEND_DO_FCALL_BY_NAME:
@@ -464,13 +462,19 @@ static inline int get_common_phi_source(zend_ssa *ssa, zend_ssa_phi *phi) {
464462
int common_source = -1;
465463
int source;
466464
FOREACH_PHI_SOURCE(phi, source) {
465+
if (source == phi->ssa_var) {
466+
continue;
467+
}
467468
if (common_source == -1) {
468469
common_source = source;
469-
} else if (common_source != source && source != phi->ssa_var) {
470+
} else if (common_source != source) {
470471
return -1;
471472
}
472473
} FOREACH_PHI_SOURCE_END();
473-
ZEND_ASSERT(common_source != -1);
474+
475+
/* If all sources are phi->ssa_var this phi must be in an unreachable cycle.
476+
* We can't easily drop the phi in that case, as we don't have something to replace it with.
477+
* Ideally SCCP would eliminate the whole cycle. */
474478
return common_source;
475479
}
476480

0 commit comments

Comments
 (0)