Skip to content

Commit e109df0

Browse files
authored
Merge branch 'master' into getimagetype
2 parents 877f076 + 3b18c06 commit e109df0

File tree

658 files changed

+13094
-20915
lines changed

Some content is hidden

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

658 files changed

+13094
-20915
lines changed

.cirrus.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ task:
1010
install_script:
1111
#- sed -i -e 's/quarterly/latest/g' /etc/pkg/FreeBSD.conf
1212
#- pkg upgrade -y
13+
- kldload accf_http
1314
- pkg install -y autoconf bison gmake re2c icu libiconv png freetype2 enchant2 bzip2 krb5 t1lib gmp tidyp libsodium libzip libxml2 libxslt openssl oniguruma pkgconf webp libavif
1415
script:
1516
- ./buildconf -f

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ env:
6969
jobs:
7070
include:
7171
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
72-
arch: arm64
72+
arch: arm64-graviton2
73+
dist: bionic
74+
virt: lxd
75+
group: edge
7376
if: type = cron
7477
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 S390X=1
7578
arch: s390x

NEWS

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3-
?? ??? ????, PHP 8.1.0alpha1
3+
?? ??? ????, PHP 8.1.0alpha2
4+
5+
- PDO:
6+
7+
. PDO OCI:
8+
. Fixed bug #77120 (Support 'success with info' at connection).
9+
(Sergei Morozov)
10+
11+
10 Jun 2021, PHP 8.1.0alpha1
412

513
- Core:
614
. Fixed inclusion order for phpize builds on Windows. (cmb)
@@ -11,6 +19,12 @@ PHP NEWS
1119
the method is private). (Nikita)
1220
. Implemented FR #77372 (Relative file path is removed from uploaded file).
1321
(Björn Tantau)
22+
. Fixed bug #81076 (incorrect debug info on Closures with implicit binds).
23+
(krakjoe)
24+
25+
- Standard:
26+
. Fixed bug #77627 (method_exists on Closure::__invoke inconsistency).
27+
(krakjoe)
1428

1529
- Date:
1630
. Fixed bug #52480 (Incorrect difference using DateInterval) (Derick)
@@ -87,6 +101,9 @@ PHP NEWS
87101
- OpenSSL:
88102
. Bump minimal OpenSSL version to 1.0.2. (Jakub Zelenka)
89103

104+
- PCRE:
105+
. Bundled PCRE2 is 10.37.
106+
90107
- PDO:
91108
. Fixed bug #40913 (PDO_MYSQL: PDO::PARAM_LOB does not bind to a stream for
92109
fetching a BLOB). (Nikita)
@@ -112,6 +129,9 @@ PHP NEWS
112129
. Convert resource<pspell> to object \PSpell\Dictionary. (Sara)
113130
. Convert resource<pspell config> to object \PSpell\Config. (Sara)
114131

132+
- readline:
133+
. Fixed bug #72998 (invalid read in readline completion). (krakjoe)
134+
115135
- Reflection:
116136
. Implement ReflectionFunctionAbstract::getClosureUsedVariables (krakjoe)
117137

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ web development. Fast, flexible and pragmatic, PHP powers everything from your
1414
blog to the most popular websites in the world. PHP is distributed under the
1515
[PHP License v3.01](LICENSE).
1616

17-
[![Build status](https://travis-ci.org/php/php-src.svg?branch=master)](https://travis-ci.org/php/php-src)
17+
[![Build status](https://travis-ci.com/php/php-src.svg?branch=master)](https://travis-ci.com/php/php-src)
1818
[![Build status](https://ci.appveyor.com/api/projects/status/meyur6fviaxgdwdy/branch/master?svg=true)](https://ci.appveyor.com/project/php/php-src)
1919
[![Build Status](https://dev.azure.com/phpazuredevops/php/_apis/build/status/php.php-src?branchName=master)](https://dev.azure.com/phpazuredevops/php/_build/latest?definitionId=1&branchName=master)
2020
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/php.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:php)

TSRM/TSRM.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,17 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
744744
#elif defined(__aarch64__)
745745
size_t ret;
746746

747+
# ifdef __APPLE__
748+
// Points to struct TLVDecriptor for _tsrm_ls_cache in macOS.
749+
asm("adrp %0, #__tsrm_ls_cache@TLVPPAGE\n\t"
750+
"ldr %0, [%0, #__tsrm_ls_cache@TLVPPAGEOFF]"
751+
: "=r" (ret));
752+
# else
747753
asm("mov %0, xzr\n\t"
748754
"add %0, %0, #:tprel_hi12:_tsrm_ls_cache, lsl #12\n\t"
749755
"add %0, %0, #:tprel_lo12_nc:_tsrm_ls_cache"
750756
: "=r" (ret));
757+
# endif
751758
return ret;
752759
#else
753760
return 0;

UPGRADING

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ PHP 8.1 UPGRADE NOTES
100100
. Classes extending mysqli_stmt::execute() will be required to specify the
101101
additional parameter now.
102102
RFC: https://wiki.php.net/rfc/mysqli_bind_in_execute
103+
. mysqli::connect() will now return true instead of null on success.
103104

104105
- MySQLnd:
105106
. The mysqlnd.fetch_copy_data ini setting has been removed. However, this
@@ -345,6 +346,9 @@ PHP 8.1 UPGRADE NOTES
345346
. Added array_is_list(array $array), which will return true if the array keys are 0 .. count($array)-1 in that order.
346347
RFC: https://wiki.php.net/rfc/is_list
347348

349+
- pcntl:
350+
. Added pcntl_rfork for FreeBSD variants
351+
348352
- Reflection:
349353
. Added ReflectionFunctionAbstract::getClosureUsedVariables
350354

@@ -400,6 +404,9 @@ PHP 8.1 UPGRADE NOTES
400404
- OpenSSL:
401405
. The OpenSSL extension now requires at least OpenSSL version 1.0.2.
402406

407+
- Sockets:
408+
. FreeBSD defines SO_ACCEPTFILTER
409+
403410
- Standard:
404411
. --with-password-argon2 now uses pkg-config to detect libargon2. As such,
405412
an alternative libargon2 location should now be specified using
@@ -414,6 +421,9 @@ PHP 8.1 UPGRADE NOTES
414421
MYSQLI_REFRESH_SLAVE, in line with an upstream change in MySQL. The old
415422
constant is still available for backwards-compatibility reasons, but may
416423
be deprecated/removed in the future.
424+
425+
- Sockets:
426+
. TCP_DEFER_ACCEPT socket option added where available.
417427

418428
========================================
419429
11. Changes to INI File Handling

UPGRADING.INTERNALS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PHP 8.1 INTERNALS UPGRADE NOTES
1313
b. ext/pdo
1414
c. ext/standard
1515
d. ext/pgsql
16+
e. ext/pcre
1617

1718
========================
1819
1. Internal API changes
@@ -22,6 +23,8 @@ PHP 8.1 INTERNALS UPGRADE NOTES
2223
spl_ce_Stringable, spl_ce_Traversable alias class entries have been removed in favor of zend_ce_aggregate,
2324
zend_ce_arrayaccess, zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_stringable,
2425
zend_ce_traversable.
26+
- The ZVAL_NEW_ARR() macro has been removed. Use array_init() or ZVAL_ARR
27+
with zend_new_array() instead.
2528
b. Zend Stream API has been changed to use "zend_string*" instead of "char*"
2629
- zend_file_handle.filename now is zend_string*
2730
- zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released.
@@ -103,3 +106,7 @@ PHP 8.1 INTERNALS UPGRADE NOTES
103106
- The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(),
104107
php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() now accept a
105108
zend_string* instead of a char* for the table name.
109+
110+
e. ext/pcre
111+
- Bundled PCRE2 is at version 10.37. The most important diff to the previous
112+
version is the JIT support on the S390 platform.

Zend/Optimizer/compact_literals.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -319,19 +319,14 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
319319

320320
#if DEBUG_COMPACT_LITERALS
321321
{
322-
int i, use_copy;
323322
fprintf(stderr, "File %s func %s\n", op_array->filename->val,
324323
op_array->function_name ? op_array->function_name->val : "main");
325324
fprintf(stderr, "Literals table size %d\n", op_array->last_literal);
326325

327-
for (i = 0; i < op_array->last_literal; i++) {
328-
zval zv;
329-
ZVAL_COPY_VALUE(&zv, op_array->literals + i);
330-
use_copy = zend_make_printable_zval(op_array->literals + i, &zv);
331-
fprintf(stderr, "Literal %d, val (%zu):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv));
332-
if (use_copy) {
333-
zval_ptr_dtor_nogc(&zv);
334-
}
326+
for (int i = 0; i < op_array->last_literal; i++) {
327+
zend_string *str = zval_get_string(op_array->literals + i);
328+
fprintf(stderr, "Literal %d, val (%zu):%s\n", i, ZSTR_LEN(str), ZSTR_VAL(str));
329+
zend_string_release(str);
335330
}
336331
fflush(stderr);
337332
}
@@ -845,17 +840,12 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
845840

846841
#if DEBUG_COMPACT_LITERALS
847842
{
848-
int i, use_copy;
849843
fprintf(stderr, "Optimized literals table size %d\n", op_array->last_literal);
850844

851-
for (i = 0; i < op_array->last_literal; i++) {
852-
zval zv;
853-
ZVAL_COPY_VALUE(&zv, op_array->literals + i);
854-
use_copy = zend_make_printable_zval(op_array->literals + i, &zv);
855-
fprintf(stderr, "Literal %d, val (%zu):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv));
856-
if (use_copy) {
857-
zval_ptr_dtor_nogc(&zv);
858-
}
845+
for (int i = 0; i < op_array->last_literal; i++) {
846+
zend_string *str = zval_get_string(op_array->literals + i);
847+
fprintf(stderr, "Literal %d, val (%zu):%s\n", i, ZSTR_LEN(str), ZSTR_VAL(str));
848+
zend_string_release(str);
859849
}
860850
fflush(stderr);
861851
}

Zend/Optimizer/pass1.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
119119
} else if (opline->extended_value == ZEND_MOD
120120
|| opline->extended_value == ZEND_SL
121121
|| opline->extended_value == ZEND_SR) {
122-
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
123-
/* don't optimize if it should produce a runtime numeric string error */
124-
if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
125-
&& !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
126-
convert_to_long(&ZEND_OP2_LITERAL(opline));
122+
zval *op2 = &ZEND_OP2_LITERAL(opline);
123+
if (Z_TYPE_P(op2) != IS_LONG) {
124+
if (!zend_is_op_long_compatible(op2)) {
125+
break;
127126
}
127+
convert_to_long(op2);
128128
}
129129
} else if (opline->extended_value == ZEND_CONCAT) {
130130
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {

Zend/Optimizer/sccp.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,14 @@ static inline int fetch_array_elem(zval **result, zval *op1, zval *op2) {
425425
case IS_LONG:
426426
*result = zend_hash_index_find(Z_ARR_P(op1), Z_LVAL_P(op2));
427427
return SUCCESS;
428-
case IS_DOUBLE:
429-
*result = zend_hash_index_find(Z_ARR_P(op1), zend_dval_to_lval(Z_DVAL_P(op2)));
428+
case IS_DOUBLE: {
429+
zend_long lval = zend_dval_to_lval(Z_DVAL_P(op2));
430+
if (!zend_is_long_compatible(Z_DVAL_P(op2), lval)) {
431+
return FAILURE;
432+
}
433+
*result = zend_hash_index_find(Z_ARR_P(op1), lval);
430434
return SUCCESS;
435+
}
431436
case IS_STRING:
432437
*result = zend_symtable_find(Z_ARR_P(op1), Z_STR_P(op2));
433438
return SUCCESS;
@@ -508,9 +513,14 @@ static inline int ct_eval_del_array_elem(zval *result, zval *key) {
508513
case IS_LONG:
509514
zend_hash_index_del(Z_ARR_P(result), Z_LVAL_P(key));
510515
break;
511-
case IS_DOUBLE:
512-
zend_hash_index_del(Z_ARR_P(result), zend_dval_to_lval(Z_DVAL_P(key)));
516+
case IS_DOUBLE: {
517+
zend_long lval = zend_dval_to_lval(Z_DVAL_P(key));
518+
if (!zend_is_long_compatible(Z_DVAL_P(key), lval)) {
519+
return FAILURE;
520+
}
521+
zend_hash_index_del(Z_ARR_P(result), lval);
513522
break;
523+
}
514524
case IS_STRING:
515525
zend_symtable_del(Z_ARR_P(result), Z_STR_P(key));
516526
break;
@@ -548,11 +558,16 @@ static inline int ct_eval_add_array_elem(zval *result, zval *value, zval *key) {
548558
SEPARATE_ARRAY(result);
549559
value = zend_hash_index_update(Z_ARR_P(result), Z_LVAL_P(key), value);
550560
break;
551-
case IS_DOUBLE:
561+
case IS_DOUBLE: {
562+
zend_long lval = zend_dval_to_lval(Z_DVAL_P(key));
563+
if (!zend_is_long_compatible(Z_DVAL_P(key), lval)) {
564+
return FAILURE;
565+
}
552566
SEPARATE_ARRAY(result);
553567
value = zend_hash_index_update(
554-
Z_ARR_P(result), zend_dval_to_lval(Z_DVAL_P(key)), value);
568+
Z_ARR_P(result), lval, value);
555569
break;
570+
}
556571
case IS_STRING:
557572
SEPARATE_ARRAY(result);
558573
value = zend_symtable_update(Z_ARR_P(result), Z_STR_P(key), value);

Zend/Optimizer/zend_func_info.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static const func_info_t func_infos[] = {
425425
F1("preg_grep", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
426426

427427
/* ext/mysqli */
428-
F1("mysqli_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
428+
F1("mysqli_connect", MAY_BE_FALSE | MAY_BE_OBJECT),
429429
F0("mysqli_close", MAY_BE_TRUE),
430430
F1("mysqli_connect_error", MAY_BE_NULL | MAY_BE_STRING),
431431
F1("mysqli_get_client_stats", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
@@ -451,7 +451,7 @@ static const func_info_t func_infos[] = {
451451
F1("mysqli_fetch_field_direct", MAY_BE_FALSE | MAY_BE_OBJECT),
452452
F1("mysqli_fetch_lengths", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
453453
F1("mysqli_fetch_row", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
454-
F1("mysqli_get_client_info", MAY_BE_NULL | MAY_BE_STRING),
454+
F1("mysqli_get_client_info", MAY_BE_STRING),
455455
F1("mysqli_get_host_info", MAY_BE_STRING),
456456
F1("mysqli_get_server_info", MAY_BE_STRING),
457457
F1("mysqli_info", MAY_BE_NULL | MAY_BE_STRING),

Zend/Optimizer/zend_inference.c

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,9 +2631,6 @@ static zend_always_inline int _zend_update_type_info(
26312631
case ZEND_PRE_INC:
26322632
case ZEND_PRE_DEC:
26332633
tmp = 0;
2634-
if (t1 & MAY_BE_REF) {
2635-
tmp |= MAY_BE_REF;
2636-
}
26372634
if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) {
26382635
tmp |= MAY_BE_RC1;
26392636
if (ssa_op->result_def >= 0) {
@@ -2670,14 +2667,17 @@ static zend_always_inline int _zend_update_type_info(
26702667
if (t1 & MAY_BE_STRING) {
26712668
tmp |= MAY_BE_STRING | MAY_BE_LONG | MAY_BE_DOUBLE;
26722669
}
2673-
tmp |= t1 & (MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE | MAY_BE_ARRAY | MAY_BE_OBJECT | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_KEY_ANY);
2674-
}
2675-
if (ssa_op->op1_def >= 0) {
2676-
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
2670+
tmp |= t1 & (MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_OBJECT);
26772671
}
26782672
if (ssa_op->result_def >= 0) {
26792673
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
26802674
}
2675+
if (ssa_op->op1_def >= 0) {
2676+
if (t1 & MAY_BE_REF) {
2677+
tmp |= MAY_BE_REF;
2678+
}
2679+
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
2680+
}
26812681
break;
26822682
case ZEND_POST_INC:
26832683
case ZEND_POST_DEC:
@@ -4481,7 +4481,6 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op,
44814481
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
44824482
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
44834483
case ZEND_DIV:
4484-
case ZEND_MOD:
44854484
if (!OP2_HAS_RANGE() ||
44864485
(OP2_MIN_RANGE() <= 0 && OP2_MAX_RANGE() >= 0)) {
44874486
/* Division by zero */
@@ -4493,10 +4492,18 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op,
44934492
case ZEND_POW:
44944493
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
44954494
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
4495+
/* Ops may throw if not an integer */
4496+
case ZEND_MOD:
4497+
if (!OP2_HAS_RANGE() ||
4498+
(OP2_MIN_RANGE() <= 0 && OP2_MAX_RANGE() >= 0)) {
4499+
/* Division by zero */
4500+
return 1;
4501+
}
4502+
ZEND_FALLTHROUGH;
44964503
case ZEND_SL:
44974504
case ZEND_SR:
4498-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4499-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4505+
return (t1 & (MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4506+
(t2 & (MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
45004507
!OP2_HAS_RANGE() ||
45014508
OP2_MIN_RANGE() < 0;
45024509
case ZEND_CONCAT:
@@ -4510,10 +4517,10 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op,
45104517
&& (t2 & MAY_BE_ANY) == MAY_BE_STRING) {
45114518
return 0;
45124519
}
4513-
return (t1 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4514-
(t2 & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
4520+
return (t1 & (MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
4521+
(t2 & (MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
45154522
case ZEND_BW_NOT:
4516-
return (t1 & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
4523+
return (t1 & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_DOUBLE|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
45174524
case ZEND_PRE_INC:
45184525
case ZEND_POST_INC:
45194526
case ZEND_PRE_DEC:

0 commit comments

Comments
 (0)