Skip to content
forked from php/php-src

merge #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
1092152
Add CURLOPT_MAXFILESIZE_LARGE option
devnexen May 15, 2022
0537560
Fix type inference
dstogov May 16, 2022
aad5fba
Merge branch 'PHP-8.0' into PHP-8.1
dstogov May 16, 2022
adc8155
Merge branch 'PHP-8.1'
dstogov May 16, 2022
72d8370
Fix parse_url(): can not recognize port without scheme
PandaLIU-1111 Dec 30, 2021
84ea0aa
Fix memory leak
dstogov May 16, 2022
c430116
Merge branch 'PHP-8.0' into PHP-8.1
dstogov May 16, 2022
462d00f
Merge branch 'PHP-8.1'
dstogov May 16, 2022
369f8da
Fix value in test case
cmb69 May 16, 2022
c8c470a
[ci skip] Order NEWS sections alphabetically
cmb69 May 16, 2022
1f4830f
Add TCP_NOTSENT_LOWAT socket option
devnexen May 15, 2022
6beee1a
Disable the read buffer in file_get_contents()
MaxKellermann Feb 3, 2022
7850c10
Add support for readonly classes (#7305)
kocsismate May 16, 2022
e9fcb5b
Disable zend_rc_debug during dl() (#8552)
arnaud-lb May 17, 2022
33fa80c
Merge branch 'PHP-8.1'
arnaud-lb May 17, 2022
2826550
Fix some minor warnings (#8568)
morrisonlevi May 18, 2022
8735ae9
Fix GH-8578: Error on wrong parameter on SoapHeader constructor
robertnisipeanu May 18, 2022
dd89aca
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 May 19, 2022
14319c2
Merge branch 'PHP-8.1'
cmb69 May 19, 2022
c06e1ab
Emit EXT_STMT for each 'elseif' clause
derickr May 17, 2022
33850fb
Merged pull request #8574
derickr May 20, 2022
9a19505
Merge branch 'PHP-8.0' into PHP-8.1
derickr May 20, 2022
852e6b9
Merge branch 'PHP-8.1'
derickr May 20, 2022
c0c801d
Fixed bug #52015 (Allow including end date in DatePeriod iterations)
derickr May 13, 2022
4f1b8f4
Add serialisation support for the new 'include_end_date' property
derickr May 20, 2022
1af354a
Add extra test case that hase both EXCLUDE_START_DATE and INCLUDE_END…
derickr May 20, 2022
f2b7c68
Merged pull request #8550
derickr May 20, 2022
46b35c6
[ci skip] Update NEWS
derickr May 20, 2022
fa78e17
Stop closing stderr and stdout streams (#8569)
morrisonlevi May 16, 2022
f2ac4f2
XFAIL tests (GH-8588)
arnaud-lb May 20, 2022
6465f3e
Merge branch 'PHP-8.0' into PHP-8.1
arnaud-lb May 20, 2022
c88dc44
Revert "XFAIL tests (GH-8588)"
arnaud-lb May 20, 2022
ffd27bd
Stop closing stderr and stdout streams (#8570)
morrisonlevi May 16, 2022
980385d
Merge branch 'PHP-8.1'
arnaud-lb May 20, 2022
c53c3e2
Stop closing stderr and stdout streams (#8571)
morrisonlevi May 16, 2022
546abc4
Integrate timelib 2021.12
derickr May 20, 2022
b510868
Adjust existing tests for fixed bugs
derickr May 20, 2022
ef55bf7
Fixed bug GH-7758 (Problems with negative timestamps and fractions)
derickr May 20, 2022
ee27762
Fixed bug #66019 (DateTime object does not support short ISO 8601 tim…
derickr May 20, 2022
20d8c1b
Fixed bug #68549 (Timezones and offsets are not properly used when wo…
derickr May 20, 2022
23dbefd
Fixed bug #51934 (strtotime plurals / incorrect time)
derickr May 20, 2022
78d5076
Fixed bug #51987 (Datetime fails to parse an ISO 8601 ordinal date (e…
derickr May 20, 2022
008016b
Fixed bug #81565 (date parsing fails when provided with timezones inc…
derickr May 20, 2022
3d53e59
Merge remote-tracking branch 'derickr/merge-timelib-2021.12-and-add-t…
derickr May 20, 2022
7fedb43
Merge branch 'PHP-8.1'
derickr May 20, 2022
33fc9e5
Build ext/zip as shared library by default on Windows
cmb69 May 13, 2022
862ef7a
Fix test expectation for date bug 81565
Girgias May 20, 2022
2410e37
Add SO_MEMINFO socket option for gathering socket related info
devnexen Apr 20, 2022
016ac7c
[skip ci] UPGRADING note update, follow-up #8411 (#8598)
devnexen May 21, 2022
9683812
Panic with abort() (#8590)
arnaud-lb May 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ PHP NEWS

- Curl:
. Added support for CURLOPT_XFERINFOFUNCTION. (David Carlier)
. Added support for CURLOPT_MAXFILESIZE_LARGE. (David Carlier)

- Date:
. Fixed GH-8458 (DateInterval::createFromDateString does not throw if
non-relative items are present). (Derick)
. Fixed bug #52015 (Allow including end date in DatePeriod iterations)
(Daniel Egeberg, Derick)
. idate() now accepts format specifiers "N" (ISO Day-of-Week) and "o" (ISO
Year). (Pavel Djundik)

Expand Down Expand Up @@ -44,31 +47,38 @@ PHP NEWS
. Added ReflectionFunction::isAnonymous(). (Nicolas Grekas)
. Added ReflectionMethod::hasPrototype(). (Ollie Read)

- Session:
. Fixed bug GH-7787 (Improve session write failure message for user error
handlers). (ilutov)

- Sockets:
. Added TCP_NOTSENT_LOWAT socket option. (David Carlier)
. Added SO_MEMINFO socket option. (David Carlier)

- Sodium:
. Added sodium_crypto_stream_xchacha20_xor_ic(). (Scott)

- SQLite3:
. Changed sqlite3.defensive from PHP_INI_SYSTEM to PHP_INI_USER. (bohwaz)

- Streams:
. Set IP_BIND_ADDRESS_NO_PORT if available when connecting to remote host.
(Cristian Rodríguez)

- Standard:
. net_get_interfaces() also reports wireless network interfaces on Windows.
(Yurun)
. Finished AVIF support in getimagesize(). (Yannis Guyon)
. Fixed bug GH-7847 (stripos with large haystack has bad performance).
(ilutov)
. New function memory_reset_peak_usage(). (Patrick Allaert)
. Fixed parse_url(): can not recognize port without scheme. (pandaLIU)

- Streams:
. Set IP_BIND_ADDRESS_NO_PORT if available when connecting to remote host.
(Cristian Rodríguez)

- Zip:
. add ZipArchive::clearError() method
. add ZipArchive::getStreamName() method
. add ZipArchive::getStreamIndex() method

- Session:
. Fixed bug GH-7787 (Improve session write failure message for user error
handlers). (ilutov)
. On Windows, the Zip extension is now built as shared library (DLL) by
default. (cmb)

<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,12 @@ PHP 8.2 UPGRADE NOTES

- Curl:
. CURLOPT_XFERINFOFUNCTION
. CURLOPT_MAXFILESIZE_LARGE

- Sockets:
. SO_INCOMING_CPU
. TCP_NOTSENT_LOWAT
. SO_MEMINFO

========================================
11. Changes to INI File Handling
Expand All @@ -220,6 +223,9 @@ PHP 8.2 UPGRADE NOTES
the configuration option --with-oci8 has been dropped. --with-oci8-11g,
--with-oci8-12c and --with-oci8-19 are still supported.

- Zip:
. The Zip extension is now built as shared library (DLL) by default.

========================================
13. Other Changes
========================================
Expand Down
3 changes: 3 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ PHP 8.2 INTERNALS UPGRADE NOTES
string_natural_case_compare_function(), and string_natural_compare_function()
have been removed. They always returned SUCCESS and were a wrapper around
strnatcmp_ex(). Use strnatcmp_ex() directly instead.
b. ext/pdo
- pdo_raise_impl_error()'s parameter sqlstate has been changed from
const char * to pdo_error_type (aka char [6]).

========================
4. OpCode changes
Expand Down
35 changes: 33 additions & 2 deletions Zend/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2067,8 +2067,39 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
}
return 0;
}
if (ssa_op->op1_def >= 0
|| ssa_op->op2_def >= 0) {
if (ssa_op->op1_def >= 0 || ssa_op->op2_def >= 0) {
if (var->use_chain < 0 && var->phi_use_chain == NULL) {
switch (opline->opcode) {
case ZEND_ASSIGN:
case ZEND_ASSIGN_REF:
case ZEND_ASSIGN_DIM:
case ZEND_ASSIGN_OBJ:
case ZEND_ASSIGN_OBJ_REF:
case ZEND_ASSIGN_STATIC_PROP:
case ZEND_ASSIGN_STATIC_PROP_REF:
case ZEND_ASSIGN_OP:
case ZEND_ASSIGN_DIM_OP:
case ZEND_ASSIGN_OBJ_OP:
case ZEND_ASSIGN_STATIC_PROP_OP:
case ZEND_PRE_INC:
case ZEND_PRE_DEC:
case ZEND_PRE_INC_OBJ:
case ZEND_PRE_DEC_OBJ:
case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
case ZEND_DO_FCALL_BY_NAME:
case ZEND_DO_FCALL:
case ZEND_INCLUDE_OR_EVAL:
case ZEND_YIELD:
case ZEND_YIELD_FROM:
case ZEND_ASSERT_CHECK:
opline->result_type = IS_UNUSED;
zend_ssa_remove_result_def(ssa, ssa_op);
break;
default:
break;
}
}
/* we cannot remove instruction that defines other variables */
return 0;
} else if (opline->opcode == ZEND_JMPZ_EX
Expand Down
4 changes: 2 additions & 2 deletions Zend/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -2708,8 +2708,8 @@ static zend_always_inline zend_result _zend_update_type_info(
tmp |= MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING;
}
}
if (!tmp) {
tmp = MAY_BE_NULL;
if (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE)) {
tmp |= MAY_BE_NULL;
}
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
The readonly class modifier can only be added once
--FILE--
<?php

readonly readonly class Foo
{
}

?>
--EXPECTF--
Fatal error: Multiple readonly modifiers are not allowed in %s on line %d
20 changes: 20 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Readonly classes cannot use dynamic properties
--FILE--
<?php

readonly class Foo
{
}

$foo = new Foo();

try {
$foo->bar = 1;
} catch (Error $exception) {
echo $exception->getMessage() . "\n";
}

?>
--EXPECT--
Cannot create dynamic property Foo::$bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Readonly classes cannot apply the #[AllowDynamicProperties] attribute
--FILE--
<?php

#[AllowDynamicProperties]
readonly class Foo
{
}

?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to readonly class Foo in %s on line %d
16 changes: 16 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_final_modifier.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
The readonly and final class modifiers can be defined in the same time
--FILE--
<?php

final readonly class Foo
{
}

readonly class Bar extends Foo
{
}

?>
--EXPECTF--
Fatal error: Class Bar cannot extend final class Foo in %s on line %d
16 changes: 16 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_inheritance_error1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Non-readonly class cannot extend a readonly class
--FILE--
<?php

readonly class Foo
{
}

class Bar extends Foo
{
}

?>
--EXPECTF--
Fatal error: Non-readonly class Bar cannot extend readonly class Foo in %s on line %d
16 changes: 16 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_inheritance_error2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Readonly class cannot extend a non-readonly class
--FILE--
<?php

class Foo
{
}

readonly class Bar extends Foo
{
}

?>
--EXPECTF--
Fatal error: Readonly class Bar cannot extend non-readonly class Foo in %s on line %d
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Readonly class can extend a readonly class
--FILE--
<?php

readonly class Foo
{
}

readonly class Bar extends Foo
{
}

?>
--EXPECT--
13 changes: 13 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_missing_type1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Normal properties of a readonly class must have type
--FILE--
<?php

readonly class Foo
{
public $bar;
}

?>
--EXPECTF--
Fatal error: Readonly property Foo::$bar must have type in %s on line %d
15 changes: 15 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_missing_type2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Promoted properties of a readonly class must have type
--FILE--
<?php

readonly class Foo
{
public function __construct(
private $bar
) {}
}

?>
--EXPECTF--
Fatal error: Readonly property Foo::$bar must have type in %s on line %d
25 changes: 25 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_property1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Normal properties of a readonly class are implicitly declared as readonly
--FILE--
<?php

readonly class Foo
{
public int $bar;

public function __construct() {
$this->bar = 1;
}
}

$foo = new Foo();

try {
$foo->bar = 2;
} catch (Error $exception) {
echo $exception->getMessage() . "\n";
}

?>
--EXPECT--
Cannot modify readonly property Foo::$bar
23 changes: 23 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_property2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Promoted properties of a readonly class are implicitly declared as readonly
--FILE--
<?php

readonly class Foo
{
public function __construct(
public int $bar
) {}
}

$foo = new Foo(1);

try {
$foo->bar = 2;
} catch (Error $exception) {
echo $exception->getMessage() . "\n";
}

?>
--EXPECT--
Cannot modify readonly property Foo::$bar
13 changes: 13 additions & 0 deletions Zend/tests/readonly_classes/readonly_class_property3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Declaring static property for a readonly class is forbidden
--FILE--
<?php

readonly class Foo
{
public static int $bar;
}

?>
--EXPECTF--
Fatal error: Readonly class Foo cannot declare static properties in %s on line %d
12 changes: 12 additions & 0 deletions Zend/tests/readonly_classes/readonly_enum.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Enums cannot be readonly
--FILE--
<?php

readonly enum Foo
{
}

?>
--EXPECTF--
Parse error: syntax error, unexpected token "enum", expecting "abstract" or "final" or "readonly" or "class" in %s on line %d
12 changes: 12 additions & 0 deletions Zend/tests/readonly_classes/readonly_interface.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Interfaces cannot be readonly
--FILE--
<?php

readonly interface Foo
{
}

?>
--EXPECTF--
Parse error: syntax error, unexpected token "interface", expecting "abstract" or "final" or "readonly" or "class" in %s on line %d
12 changes: 12 additions & 0 deletions Zend/tests/readonly_classes/readonly_trait.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Traits cannot be readonly
--FILE--
<?php

readonly trait Foo
{
}

?>
--EXPECTF--
Parse error: syntax error, unexpected token "trait", expecting "abstract" or "final" or "readonly" or "class" in %s on line %d
Loading