Skip to content

Commit e80e7c1

Browse files
authored
Merge pull request #13 from php/master
sync
2 parents d4b78af + 8683d17 commit e80e7c1

File tree

198 files changed

+7034
-3403
lines changed

Some content is hidden

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

198 files changed

+7034
-3403
lines changed

.github/workflows/remove-needs-feedback.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ jobs:
1313
- uses: actions-ecosystem/action-remove-labels@v1
1414
with:
1515
labels: "Status: Needs Feedback"
16+
- uses: actions-ecosystem/action-add-labels@v1
17+
with:
18+
labels: "Status: Needs Triage"

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ repository. Mailing list subscription is explained on the
8080
[mailing lists page](https://www.php.net/mailing-lists.php).
8181

8282
You may also want to read
83-
[The Mysterious PHP RFC Process](https://blogs.oracle.com/opal/entry/the_mysterious_php_rfc_process)
83+
[The Mysterious PHP RFC Process](https://blogs.oracle.com/opal/post/the-mysterious-php-rfc-process-and-how-you-can-change-the-web)
8484
for additional notes on the best way to approach submitting an RFC.
8585

8686
## Writing tests

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ PHP NEWS
1313

1414
- OCI8:
1515
. Added oci8.prefetch_lob_size directive to tune LOB query performance
16+
. Support for building against Oracle Client libraries 10.1 and 10.2 has been
17+
dropped. Oracle Client libraries 11.2 or newer are now required.
1618

1719
- Standard:
1820
. net_get_interfaces() also reports wireless network interfaces on Windows.
1921
(Yurun)
22+
. Finished AVIF support in getimagesize(). (Yannis Guyon)
2023

2124
- Zip:
2225
. add ZipArchive::clearError() method

README.REDIST.BINS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
15. ext/phar/zip.c portion extracted from libzip
1616
16. libbcmath (ext/bcmath) see ext/bcmath/libbcmath/LICENSE
1717
17. ext/mbstring/ucgendat portions based on the ucgendat.c from the OpenLDAP
18+
18. avifinfo (ext/standard/libavifinfo) see ext/standard/libavifinfo/LICENSE
1819

1920

2021
3. pcre2lib (ext/pcre)
@@ -591,7 +592,7 @@ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
591592
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
592593

593594

594-
16. ext/mbstring/ucgendat portions based on the ucgendat.c from the OpenLDAP
595+
17. ext/mbstring/ucgendat portions based on the ucgendat.c from the OpenLDAP
595596

596597
The OpenLDAP Public License
597598
Version 2.8, 17 August 2003

UPGRADING

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ PHP 8.2 UPGRADE NOTES
1919
1. Backward Incompatible Changes
2020
========================================
2121

22+
- Standard:
23+
. strtolower() and strtoupper() are no longer locale-sensitive. They now
24+
perform ASCII case conversion, as if the locale were "C". Use
25+
mb_strtolower() if you want localized case conversion. Similarly, stristr,
26+
stripos, strripos, lcfirst, ucfirst, ucwords, str_ireplace,
27+
array_change_key_case and sorting with SORT_FLAG_CASE use ASCII case
28+
conversion.
29+
2230
========================================
2331
2. New Features
2432
========================================
@@ -28,9 +36,10 @@ PHP 8.2 UPGRADE NOTES
2836
HTTP method in curl_getinfo() return value.
2937

3038
- OCI8:
31-
. Added an oci8.prefetch_lob_size directive to tune LOB query performance
32-
by reducing the number of round-trips between PHP and Oracle Database when
33-
fetching LOBS. This is usable with Oracle Database 12.2 or later.
39+
. Added an oci8.prefetch_lob_size directive and oci_set_prefetch_lob()
40+
function to tune LOB query performance by reducing the number of
41+
round-trips between PHP and Oracle Database when fetching LOBS. This is
42+
usable with Oracle Database 12.2 or later.
3443

3544
- PCRE:
3645
. Added support for the "n" (NO_AUTO_CAPTURE) modifier, which makes simple
@@ -117,6 +126,14 @@ PHP 8.2 UPGRADE NOTES
117126
9. Other Changes to Extensions
118127
========================================
119128

129+
- OCI8:
130+
. The minimum Oracle Client library version required is now 11.2.
131+
132+
- Standard:
133+
. getimagesize() now reports the actual image dimensions, bits and channels
134+
of AVIF images. Previously, the dimensions have been reported as 0x0, and
135+
bits and channels have not been reported at all.
136+
120137
- Zip:
121138
. extension updated to 1.20.0 with new methods:
122139
ZipArchive::clearError, getStreamName and getStreamIndex
@@ -128,6 +145,9 @@ PHP 8.2 UPGRADE NOTES
128145
- COM_DOTNET:
129146
. LOCALE_NEUTRAL
130147

148+
- Sockets:
149+
. SO_INCOMING_CPU
150+
131151
========================================
132152
11. Changes to INI File Handling
133153
========================================
@@ -140,6 +160,11 @@ PHP 8.2 UPGRADE NOTES
140160
. Windows specific error messages are no longer localized, but instead in
141161
English to better match PHP error messages.
142162

163+
- OCI8:
164+
. Since building against Oracle Client 10g is no longer supported anyway,
165+
the configuration option --with-oci8 has been dropped. --with-oci8-11g,
166+
--with-oci8-12c and --with-oci8-19 are still supported.
167+
143168
========================================
144169
13. Other Changes
145170
========================================

UPGRADING.INTERNALS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ PHP 8.2 INTERNALS UPGRADE NOTES
66

77
3. Module changes
88

9+
4. OpCode changes
10+
911
========================
1012
1. Internal API changes
1113
========================
@@ -24,3 +26,14 @@ PHP 8.2 INTERNALS UPGRADE NOTES
2426
3. Module changes
2527
========================
2628

29+
========================
30+
4. OpCode changes
31+
========================
32+
33+
* The ZEND_INIT_FCALL opcode now asserts that the function exists in the symbol
34+
table as the function's existence is checked at compile time.
35+
For extensions modifying the function symbol table, setting
36+
CG(compiler_options) |= ZEND_COMPILE_IGNORE_USER_FUNCTIONS | ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS;
37+
will produce ZEND_INIT_FCALL_BY_NAME opcodes instead which check for the
38+
existence of the function at runtime.
39+

Zend/Optimizer/dce.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,10 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, bool reorder_d
620620
while ((i = zend_bitset_pop_first(ctx.instr_worklist, ctx.instr_worklist_len)) >= 0) {
621621
zend_bitset_excl(ctx.instr_dead, i);
622622
add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 1);
623-
if (i < op_array->last && op_array->opcodes[i+1].opcode == ZEND_OP_DATA) {
623+
if (i < op_array->last
624+
&& (op_array->opcodes[i+1].opcode == ZEND_OP_DATA
625+
|| (op_array->opcodes[i].opcode == ZEND_NEW
626+
&& op_array->opcodes[i+1].opcode == ZEND_DO_FCALL))) {
624627
zend_bitset_excl(ctx.instr_dead, i+1);
625628
add_operands_to_worklists(&ctx, &op_array->opcodes[i+1], &ssa->ops[i+1], ssa, 1);
626629
}

Zend/Optimizer/dfa_pass.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static inline bool can_elide_return_type_check(
308308
}
309309

310310
static bool opline_supports_assign_contraction(
311-
zend_ssa *ssa, zend_op *opline, int src_var, uint32_t cv_var) {
311+
zend_op_array *op_array, zend_ssa *ssa, zend_op *opline, int src_var, uint32_t cv_var) {
312312
if (opline->opcode == ZEND_NEW) {
313313
/* see Zend/tests/generators/aborted_yield_during_new.phpt */
314314
return 0;
@@ -342,6 +342,13 @@ static bool opline_supports_assign_contraction(
342342
return opline->op1_type != IS_CV || opline->op1.var != cv_var;
343343
}
344344

345+
if (opline->opcode == ZEND_ASSIGN_OP
346+
&& opline->op1_type == IS_CV
347+
&& opline->op1.var == cv_var
348+
&& zend_may_throw(opline, &ssa->ops[ssa->vars[src_var].definition], op_array, ssa)) {
349+
return 0;
350+
}
351+
345352
return 1;
346353
}
347354

@@ -716,9 +723,13 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa)
716723
uint32_t op_num;
717724
zend_op *opline;
718725
zend_ssa_op *ssa_op;
726+
bool can_follow = 1;
719727

720728
while (next_block_num < ssa->cfg.blocks_count
721729
&& !(ssa->cfg.blocks[next_block_num].flags & ZEND_BB_REACHABLE)) {
730+
if (ssa->cfg.blocks[next_block_num].flags & ZEND_BB_UNREACHABLE_FREE) {
731+
can_follow = 0;
732+
}
722733
next_block_num++;
723734
}
724735

@@ -730,7 +741,7 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa)
730741
switch (opline->opcode) {
731742
case ZEND_JMP:
732743
optimize_jmp:
733-
if (block->successors[0] == next_block_num) {
744+
if (block->successors[0] == next_block_num && can_follow) {
734745
MAKE_NOP(opline);
735746
removed_ops++;
736747
goto optimize_nop;
@@ -751,7 +762,7 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa)
751762
goto optimize_jmp;
752763
}
753764
} else {
754-
if (block->successors[0] == next_block_num) {
765+
if (block->successors[0] == next_block_num && can_follow) {
755766
take_successor_0(ssa, block_num, block);
756767
if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) {
757768
opline->opcode = ZEND_CHECK_VAR;
@@ -782,7 +793,7 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa)
782793
goto optimize_nop;
783794
}
784795
} else if (block->successors_count == 2) {
785-
if (block->successors[0] == next_block_num) {
796+
if (block->successors[0] == next_block_num && can_follow) {
786797
take_successor_0(ssa, block_num, block);
787798
if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) {
788799
opline->opcode = ZEND_CHECK_VAR;
@@ -816,7 +827,7 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa)
816827
} else if (block->successors_count == 2) {
817828
if (block->successors[0] == block->successors[1]) {
818829
take_successor_0(ssa, block_num, block);
819-
if (block->successors[0] == next_block_num) {
830+
if (block->successors[0] == next_block_num && can_follow) {
820831
if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) {
821832
opline->opcode = ZEND_CHECK_VAR;
822833
opline->op2.num = 0;
@@ -1327,7 +1338,7 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
13271338
&& !ssa->vars[src_var].phi_use_chain
13281339
&& !ssa->vars[src_var].sym_use_chain
13291340
&& opline_supports_assign_contraction(
1330-
ssa, &op_array->opcodes[ssa->vars[src_var].definition],
1341+
op_array, ssa, &op_array->opcodes[ssa->vars[src_var].definition],
13311342
src_var, opline->result.var)
13321343
&& !variable_defined_or_used_in_range(ssa, EX_VAR_TO_NUM(opline->result.var),
13331344
ssa->vars[src_var].definition+1, op_1)
@@ -1486,7 +1497,7 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
14861497
&& !ssa->vars[src_var].phi_use_chain
14871498
&& !ssa->vars[src_var].sym_use_chain
14881499
&& opline_supports_assign_contraction(
1489-
ssa, &op_array->opcodes[ssa->vars[src_var].definition],
1500+
op_array, ssa, &op_array->opcodes[ssa->vars[src_var].definition],
14901501
src_var, opline->op1.var)
14911502
&& !variable_defined_or_used_in_range(ssa, EX_VAR_TO_NUM(opline->op1.var),
14921503
ssa->vars[src_var].definition+1, op_1)

Zend/Optimizer/pass1.c

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,33 +103,9 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
103103
break;
104104

105105
case ZEND_ASSIGN_OP:
106-
if (opline->op2_type == IS_CONST) {
107-
if (opline->extended_value == ZEND_ADD
108-
|| opline->extended_value == ZEND_SUB
109-
|| opline->extended_value == ZEND_MUL
110-
|| opline->extended_value == ZEND_DIV
111-
|| opline->extended_value == ZEND_POW) {
112-
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
113-
/* don't optimize if it should produce a runtime numeric string error */
114-
if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
115-
convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
116-
}
117-
}
118-
} else if (opline->extended_value == ZEND_MOD
119-
|| opline->extended_value == ZEND_SL
120-
|| opline->extended_value == ZEND_SR) {
121-
zval *op2 = &ZEND_OP2_LITERAL(opline);
122-
if (Z_TYPE_P(op2) != IS_LONG) {
123-
if (!zend_is_op_long_compatible(op2)) {
124-
break;
125-
}
126-
convert_to_long(op2);
127-
}
128-
} else if (opline->extended_value == ZEND_CONCAT) {
129-
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
130-
convert_to_string(&ZEND_OP2_LITERAL(opline));
131-
}
132-
}
106+
if (opline->extended_value == ZEND_CONCAT && opline->op2_type == IS_CONST
107+
&& Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
108+
convert_to_string(&ZEND_OP2_LITERAL(opline));
133109
}
134110
break;
135111

Zend/Optimizer/sccp.c

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -799,59 +799,21 @@ static inline zend_result ct_eval_array_key_exists(zval *result, zval *op1, zval
799799
return SUCCESS;
800800
}
801801

802-
static bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zval **args) {
803-
/* Functions in this list must always produce the same result for the same arguments,
802+
static bool can_ct_eval_func_call(zend_function *func, zend_string *name, uint32_t num_args, zval **args) {
803+
/* Precondition: func->type == ZEND_INTERNAL_FUNCTION, this is a global function */
804+
/* Functions setting ZEND_ACC_COMPILE_TIME_EVAL (@compile-time-eval) must always produce the same result for the same arguments,
804805
* and have no dependence on global state (such as locales). It is okay if they throw
805806
* or warn on invalid arguments, as we detect this and will discard the evaluation result. */
806-
if (false
807-
|| zend_string_equals_literal(name, "array_diff")
808-
|| zend_string_equals_literal(name, "array_diff_assoc")
809-
|| zend_string_equals_literal(name, "array_diff_key")
810-
|| zend_string_equals_literal(name, "array_flip")
811-
|| zend_string_equals_literal(name, "array_is_list")
812-
|| zend_string_equals_literal(name, "array_key_exists")
813-
|| zend_string_equals_literal(name, "array_keys")
814-
|| zend_string_equals_literal(name, "array_merge")
815-
|| zend_string_equals_literal(name, "array_merge_recursive")
816-
|| zend_string_equals_literal(name, "array_replace")
817-
|| zend_string_equals_literal(name, "array_replace_recursive")
818-
|| zend_string_equals_literal(name, "array_unique")
819-
|| zend_string_equals_literal(name, "array_values")
820-
|| zend_string_equals_literal(name, "base64_decode")
821-
|| zend_string_equals_literal(name, "base64_encode")
807+
if (func->common.fn_flags & ZEND_ACC_COMPILE_TIME_EVAL) {
808+
/* This has @compile-time-eval in stub info and uses a macro such as ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE */
809+
return true;
810+
}
822811
#ifndef ZEND_WIN32
823-
/* On Windows this function may be code page dependent. */
824-
|| zend_string_equals_literal(name, "dirname")
825-
#endif
826-
|| zend_string_equals_literal(name, "explode")
827-
|| zend_string_equals_literal(name, "imagetypes")
828-
|| zend_string_equals_literal(name, "in_array")
829-
|| zend_string_equals_literal(name, "implode")
830-
|| zend_string_equals_literal(name, "ltrim")
831-
|| zend_string_equals_literal(name, "php_sapi_name")
832-
|| zend_string_equals_literal(name, "php_uname")
833-
|| zend_string_equals_literal(name, "phpversion")
834-
|| zend_string_equals_literal(name, "pow")
835-
|| zend_string_equals_literal(name, "preg_quote")
836-
|| zend_string_equals_literal(name, "rawurldecode")
837-
|| zend_string_equals_literal(name, "rawurlencode")
838-
|| zend_string_equals_literal(name, "rtrim")
839-
|| zend_string_equals_literal(name, "serialize")
840-
|| zend_string_equals_literal(name, "str_contains")
841-
|| zend_string_equals_literal(name, "str_ends_with")
842-
|| zend_string_equals_literal(name, "str_replace")
843-
|| zend_string_equals_literal(name, "str_split")
844-
|| zend_string_equals_literal(name, "str_starts_with")
845-
|| zend_string_equals_literal(name, "strpos")
846-
|| zend_string_equals_literal(name, "strstr")
847-
|| zend_string_equals_literal(name, "substr")
848-
|| zend_string_equals_literal(name, "trim")
849-
|| zend_string_equals_literal(name, "urldecode")
850-
|| zend_string_equals_literal(name, "urlencode")
851-
|| zend_string_equals_literal(name, "version_compare")
852-
) {
812+
/* On Windows this function may be code page dependent. */
813+
if (zend_string_equals_literal(name, "dirname")) {
853814
return true;
854815
}
816+
#endif
855817

856818
if (num_args == 2) {
857819
if (zend_string_equals_literal(name, "str_repeat")) {
@@ -918,7 +880,7 @@ static inline zend_result ct_eval_func_call(
918880
}
919881
}
920882

921-
if (!can_ct_eval_func_call(name, num_args, args)) {
883+
if (!can_ct_eval_func_call(func, name, num_args, args)) {
922884
return FAILURE;
923885
}
924886

@@ -2244,6 +2206,17 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
22442206
zend_ssa_remove_result_def(ssa, ssa_op);
22452207
if (opline->opcode == ZEND_DO_ICALL) {
22462208
removed_ops = remove_call(ctx, opline, ssa_op);
2209+
} else if (opline->opcode == ZEND_TYPE_CHECK
2210+
&& (opline->op1_type & (IS_VAR|IS_TMP_VAR))
2211+
&& (!value_known(&ctx->values[ssa_op->op1_use])
2212+
|| IS_PARTIAL_ARRAY(&ctx->values[ssa_op->op1_use])
2213+
|| IS_PARTIAL_OBJECT(&ctx->values[ssa_op->op1_use]))) {
2214+
/* For TYPE_CHECK we may compute the result value without knowing the
2215+
* operand, based on type inference information. Make sure the operand is
2216+
* freed and leave further cleanup to DCE. */
2217+
opline->opcode = ZEND_FREE;
2218+
opline->result_type = IS_UNUSED;
2219+
removed_ops++;
22472220
} else {
22482221
zend_ssa_remove_instr(ssa, opline, ssa_op);
22492222
removed_ops++;

0 commit comments

Comments
 (0)