Skip to content

Commit f97a395

Browse files
authored
Merge pull request #2 from php/master
merge
2 parents e3f29b4 + 8a49310 commit f97a395

File tree

393 files changed

+4503
-3037
lines changed

Some content is hidden

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

393 files changed

+4503
-3037
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
git:
22
quiet: true
33

4-
dist: xenial
4+
dist: bionic
55
language: c
66
os: linux
77
addons:
@@ -74,8 +74,9 @@ jobs:
7474
arch: amd64
7575
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
7676
arch: arm64
77-
#- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 S390X=1
78-
# arch: s390x
77+
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 S390X=1
78+
arch: s390x
79+
if: type = cron
7980

8081
before_script:
8182
- ccache --version

NEWS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.0.0rc1
44

5+
- Core:
6+
. Implement #[Attr] Attribute syntax as per final vote in RFC
7+
https://wiki.php.net/rfc/shorter_attribute_syntax_change
8+
. Fixed bug #80045 (memleak after two set_exception_handler calls with
9+
__call). (Nikita)
10+
11+
- Date:
12+
. Fixed bug #80057 (DateTimeImmutable::createFromFormat() does not populate
13+
time). (Derick)
514

615
03 Sep 2020, PHP 8.0.0beta3
716

UPGRADING

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ PHP 8.0 UPGRADE NOTES
8181
Additionally, care should be taken that error messages are not displayed in
8282
production environments, which can result in information leaks. Please
8383
ensure that display_errors=Off is used in conjunction with error logging.
84-
. Adding more than one @ operator to an expression is no longer supported,
85-
since this syntax is now used for attributes (previously extra @ operators
86-
had no effect).
87-
RFC: https://wiki.php.net/rfc/shorter_attribute_syntax
84+
. Following the hash comment operator # immediately with an opening bracket
85+
is not supported as a comment anymore since this syntax is now used for
86+
attributes.
87+
RFC: https://wiki.php.net/rfc/shorter_attribute_syntax_change
8888
. Inheritance errors due to incompatible method signatures (LSP violations)
8989
will now always generate a fatal error. Previously a warning was generated
9090
in some cases.
@@ -576,6 +576,9 @@ PHP 8.0 UPGRADE NOTES
576576

577577
$ctx = stream_context_create(['http' => ['protocol_version' => '1.0']]);
578578
echo file_get_contents('http://example.org', false, $ctx);
579+
. Calling crypt() without an explicit salt is no longer supported. If you
580+
would like to produce a strong hash with an auto-generated salt, use
581+
password_hash() instead.
579582

580583
- Sysvmsg:
581584
. msg_get_queue() will now return an SysvMessageQueue object rather than a
@@ -687,6 +690,7 @@ PHP 8.0 UPGRADE NOTES
687690
RFC: https://wiki.php.net/rfc/attributes_v2
688691
RFC: https://wiki.php.net/rfc/attribute_amendments
689692
RFC: https://wiki.php.net/rfc/shorter_attribute_syntax
693+
RFC: https://wiki.php.net/rfc/shorter_attribute_syntax_change
690694
. Added support for constructor property promotion (declaring properties in
691695
the constructor signature).
692696
RFC: https://wiki.php.net/rfc/constructor_promotion

UPGRADING.INTERNALS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
309309
- zend_multibyte_set_filter()
310310
- zend_lex_tstring()
311311
- _zend_module_entry module_startup_func, module_shutdown_func,
312-
request_startup_func, and request_shutdown_func function pointers
312+
request_startup_func, request_shutdown_func, and post_deactivate_func function pointers
313313
- (*zend_encoding_list_parser) typedef
314314
- (*zend_encoding_internal_encoding_setter) typedef
315315
- zend_multibyte_set_functions()

Zend/tests/attributes/001_placement.phpt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ Attributes can be placed on all supported elements.
33
--FILE--
44
<?php
55

6-
@@A1(1)
6+
#[A1(1)]
77
class Foo
88
{
9-
@@A1(2)
9+
#[A1(2)]
1010
public const FOO = 'foo';
11-
12-
@@A1(3)
11+
12+
#[A1(3)]
1313
public $x;
14-
15-
@@A1(4)
16-
public function foo(@@A1(5) $a, @@A1(6) $b) { }
14+
15+
#[A1(4)]
16+
public function foo(#[A1(5)] $a, #[A1(6)] $b) { }
1717
}
1818

19-
$object = new @@A1(7) class () { };
19+
$object = new #[A1(7)] class () { };
2020

21-
@@A1(8)
21+
#[A1(8)]
2222
function f1() { }
2323

24-
$f2 = @@A1(9) function () { };
24+
$f2 = #[A1(9)] function () { };
2525

26-
$f3 = @@A1(10) fn () => 1;
26+
$f3 = #[A1(10)] fn () => 1;
2727

2828
$ref = new \ReflectionClass(Foo::class);
2929

@@ -43,11 +43,11 @@ $sources = [
4343
foreach ($sources as $r) {
4444
$attr = $r->getAttributes();
4545
var_dump(get_class($r), count($attr));
46-
46+
4747
foreach ($attr as $a) {
4848
var_dump($a->getName(), $a->getArguments());
4949
}
50-
50+
5151
echo "\n";
5252
}
5353

Zend/tests/attributes/002_rfcexample.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Attributes: Example from Attributes RFC
66
namespace My\Attributes {
77
use Attribute;
88

9-
@@Attribute
9+
#[Attribute]
1010
class SingleArgument {
1111
public $argumentValue;
1212

@@ -19,7 +19,7 @@ namespace My\Attributes {
1919
namespace {
2020
use My\Attributes\SingleArgument;
2121

22-
@@SingleArgument("Hello World")
22+
#[SingleArgument("Hello World")]
2323
class Foo {
2424
}
2525

Zend/tests/attributes/003_ast_nodes.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Attributes can deal with AST nodes.
55

66
define('V1', strtoupper(php_sapi_name()));
77

8-
@@A1([V1 => V1])
8+
#[A1([V1 => V1])]
99
class C1
1010
{
1111
public const BAR = 'bar';
@@ -20,7 +20,7 @@ var_dump(count($args), $args[0][V1] === V1);
2020

2121
echo "\n";
2222

23-
@@A1(V1, 1 + 2, C1::class)
23+
#[A1(V1, 1 + 2, C1::class)]
2424
class C2 { }
2525

2626
$ref = new \ReflectionClass(C2::class);
@@ -35,7 +35,7 @@ var_dump($args[2] === C1::class);
3535

3636
echo "\n";
3737

38-
@@A1(self::FOO, C1::BAR)
38+
#[A1(self::FOO, C1::BAR)]
3939
class C3
4040
{
4141
private const FOO = 'foo';
@@ -52,20 +52,20 @@ var_dump($args[1] === C1::BAR);
5252

5353
echo "\n";
5454

55-
@@ExampleWithShift(4 >> 1)
55+
#[ExampleWithShift(4 >> 1)]
5656
class C4 {}
5757
$ref = new \ReflectionClass(C4::class);
5858
var_dump($ref->getAttributes()[0]->getArguments());
5959

6060
echo "\n";
6161

62-
@@Attribute
62+
#[Attribute]
6363
class C5
6464
{
6565
public function __construct() { }
6666
}
6767

68-
$ref = new \ReflectionFunction(@@C5(MissingClass::SOME_CONST) function () { });
68+
$ref = new \ReflectionFunction(#[C5(MissingClass::SOME_CONST)] function () { });
6969
$attr = $ref->getAttributes();
7070
var_dump(count($attr));
7171

Zend/tests/attributes/004_name_resolution.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ namespace Foo {
2525
use Doctrine\ORM\Mapping as ORM;
2626
use Doctrine\ORM\Attributes;
2727

28-
@@Entity("imported class")
29-
@@ORM\Entity("imported namespace")
30-
@@\Doctrine\ORM\Mapping\Entity("absolute from namespace")
31-
@@\Entity("import absolute from global")
32-
@@Attributes\Table()
28+
#[Entity("imported class")]
29+
#[ORM\Entity("imported namespace")]
30+
#[\Doctrine\ORM\Mapping\Entity("absolute from namespace")]
31+
#[\Entity("import absolute from global")]
32+
#[Attributes\Table()]
3333
function foo() {
3434
}
3535
}

Zend/tests/attributes/005_objects.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Attributes can be converted into objects.
33
--FILE--
44
<?php
55

6-
@@Attribute(Attribute::TARGET_FUNCTION)
6+
#[Attribute(Attribute::TARGET_FUNCTION)]
77
class A1
88
{
99
public string $name;
@@ -16,7 +16,7 @@ class A1
1616
}
1717
}
1818

19-
$ref = new \ReflectionFunction(@@A1('test') function () { });
19+
$ref = new \ReflectionFunction(#[A1('test')] function () { });
2020

2121
foreach ($ref->getAttributes() as $attr) {
2222
$obj = $attr->newInstance();
@@ -26,7 +26,7 @@ foreach ($ref->getAttributes() as $attr) {
2626

2727
echo "\n";
2828

29-
$ref = new \ReflectionFunction(@@A1 function () { });
29+
$ref = new \ReflectionFunction(#[A1] function () { });
3030

3131
try {
3232
$ref->getAttributes()[0]->newInstance();
@@ -36,7 +36,7 @@ try {
3636

3737
echo "\n";
3838

39-
$ref = new \ReflectionFunction(@@A1([]) function () { });
39+
$ref = new \ReflectionFunction(#[A1([])] function () { });
4040

4141
try {
4242
$ref->getAttributes()[0]->newInstance();
@@ -46,7 +46,7 @@ try {
4646

4747
echo "\n";
4848

49-
$ref = new \ReflectionFunction(@@A2 function () { });
49+
$ref = new \ReflectionFunction(#[A2] function () { });
5050

5151
try {
5252
$ref->getAttributes()[0]->newInstance();
@@ -56,13 +56,13 @@ try {
5656

5757
echo "\n";
5858

59-
@@Attribute
59+
#[Attribute]
6060
class A3
6161
{
6262
private function __construct() { }
6363
}
6464

65-
$ref = new \ReflectionFunction(@@A3 function () { });
65+
$ref = new \ReflectionFunction(#[A3] function () { });
6666

6767
try {
6868
$ref->getAttributes()[0]->newInstance();
@@ -72,10 +72,10 @@ try {
7272

7373
echo "\n";
7474

75-
@@Attribute
75+
#[Attribute]
7676
class A4 { }
7777

78-
$ref = new \ReflectionFunction(@@A4(1) function () { });
78+
$ref = new \ReflectionFunction(#[A4(1)] function () { });
7979

8080
try {
8181
$ref->getAttributes()[0]->newInstance();
@@ -87,7 +87,7 @@ echo "\n";
8787

8888
class A5 { }
8989

90-
$ref = new \ReflectionFunction(@@A5 function () { });
90+
$ref = new \ReflectionFunction(#[A5] function () { });
9191

9292
try {
9393
$ref->getAttributes()[0]->newInstance();

Zend/tests/attributes/006_filter.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ Attributes can be filtered by name and base type.
33
--FILE--
44
<?php
55

6-
$ref = new \ReflectionFunction(@@A1 @@A2 function () { });
6+
$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
77
$attr = $ref->getAttributes(A3::class);
88

99
var_dump(count($attr));
1010

11-
$ref = new \ReflectionFunction(@@A1 @@A2 function () { });
11+
$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
1212
$attr = $ref->getAttributes(A2::class);
1313

1414
var_dump(count($attr), $attr[0]->getName());
1515

16-
$ref = new \ReflectionFunction(@@A1 @@A2 @@A2 function () { });
16+
$ref = new \ReflectionFunction(#[A1] #[A2] #[A2] function () { });
1717
$attr = $ref->getAttributes(A2::class);
1818

1919
var_dump(count($attr), $attr[0]->getName(), $attr[1]->getName());
@@ -25,27 +25,27 @@ class A1 implements Base { }
2525
class A2 implements Base { }
2626
class A3 extends A2 { }
2727

28-
$ref = new \ReflectionFunction(@@A1 @@A2 @@A5 function () { });
28+
$ref = new \ReflectionFunction(#[A1] #[A2] #[A5] function () { });
2929
$attr = $ref->getAttributes(\stdClass::class, \ReflectionAttribute::IS_INSTANCEOF);
3030
var_dump(count($attr));
3131
print_r(array_map(fn ($a) => $a->getName(), $attr));
3232

33-
$ref = new \ReflectionFunction(@@A1 @@A2 function () { });
33+
$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
3434
$attr = $ref->getAttributes(A1::class, \ReflectionAttribute::IS_INSTANCEOF);
3535
var_dump(count($attr));
3636
print_r(array_map(fn ($a) => $a->getName(), $attr));
3737

38-
$ref = new \ReflectionFunction(@@A1 @@A2 function () { });
38+
$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
3939
$attr = $ref->getAttributes(Base::class, \ReflectionAttribute::IS_INSTANCEOF);
4040
var_dump(count($attr));
4141
print_r(array_map(fn ($a) => $a->getName(), $attr));
4242

43-
$ref = new \ReflectionFunction(@@A1 @@A2 @@A3 function () { });
43+
$ref = new \ReflectionFunction(#[A1] #[A2] #[A3] function () { });
4444
$attr = $ref->getAttributes(A2::class, \ReflectionAttribute::IS_INSTANCEOF);
4545
var_dump(count($attr));
4646
print_r(array_map(fn ($a) => $a->getName(), $attr));
4747

48-
$ref = new \ReflectionFunction(@@A1 @@A2 @@A3 function () { });
48+
$ref = new \ReflectionFunction(#[A1] #[A2] #[A3] function () { });
4949
$attr = $ref->getAttributes(Base::class, \ReflectionAttribute::IS_INSTANCEOF);
5050
var_dump(count($attr));
5151
print_r(array_map(fn ($a) => $a->getName(), $attr));

Zend/tests/attributes/008_wrong_attribution.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Attributes: Prevent Attribute on non classes
33
--FILE--
44
<?php
55

6-
@@Attribute
6+
#[Attribute]
77
function foo() {}
88
?>
99
--EXPECTF--

0 commit comments

Comments
 (0)