Skip to content

Commit 0d6184e

Browse files
Merge pull request #4 from php/master
Updating fork
2 parents 3f52368 + aecb05f commit 0d6184e

File tree

390 files changed

+10750
-9583
lines changed

Some content is hidden

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

390 files changed

+10750
-9583
lines changed

NEWS

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3-
?? ??? ????, PHP 8.0.0RC1
3+
?? ??? ????, PHP 8.0.0rc2
4+
5+
6+
01 Oct 2020, PHP 8.0.0rc1
47

58
- CLI:
69
. Allow debug server binding to an ephemeral port via `-S localhost:0`. (Sara)
10+
711
- Core:
812
. Fixed bug #80109 (Cannot skip arguments when extended debug is enabled).
913
(Nikita)
14+
15+
- ODBC:
16+
. Fixed bug #22986 (odbc_connect() may reuse persistent connection). (cmb)
17+
18+
- PDO_Firebird:
19+
. Fixed bug #64937 (Firebird PDO preprocessing sql). (Simonov Denis)
20+
1021
- SPL:
1122
. SplFixedArray is now IteratorAggregate rather than Iterator. (alexdowad)
1223

24+
- Zlib:
25+
. Fixed bug #78792 (zlib.output_compression disabled by Content-Type: image/).
26+
(cmb)
27+
1328
17 Sep 2020, PHP 8.0.0beta4
1429

1530
- Core:

UPGRADING

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ PHP 8.0 UPGRADE NOTES
254254
__wakeup(): void
255255

256256
RFC: https://wiki.php.net/rfc/magic-methods-signature
257+
. call_user_func_array() array keys will now be interpreted as parameter names,
258+
instead of being silently ignored.
257259

258260
- COM:
259261
. Removed the ability to import case-insensitive constants from type
@@ -391,6 +393,10 @@ PHP 8.0 UPGRADE NOTES
391393
. Several alias functions have been marked as deprecated.
392394
. oci_internal_debug() and its alias ociinternaldebug() have been removed.
393395

396+
- ODBC:
397+
. odbc_connect() no longer reuses persistent connections.
398+
. The unused flags parameter of odbc_exec() has been removed.
399+
394400
- OpenSSL:
395401
. openssl_x509_read() and openssl_csr_sign() will now return an
396402
OpenSSLCertificate object rather than a resource. Return value checks using
@@ -656,6 +662,8 @@ PHP 8.0 UPGRADE NOTES
656662
. deflate_init() will now return a DeflateContext object rather than a
657663
resource. Return value checks using is_resource() should be replaced with
658664
checks for `false`.
665+
. zlib.output_compression is no longer automatically disabled for
666+
Content-Type: image/*.
659667

660668
========================================
661669
2. New Features
@@ -804,7 +812,7 @@ PHP 8.0 UPGRADE NOTES
804812
values rather than int.
805813

806814
- Zip:
807-
. Extension updated to version 1.19.0
815+
. Extension updated to version 1.19.1
808816
. New ZipArchive::lastId property to get index value of last added entry.
809817
. Error can be checked after an archive is closed using ZipArchive::status,
810818
ZipArchive::statusSys properties or ZipArchive::getStatusString() method.

UPGRADING.INTERNALS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,14 @@ PHP 8.0 INTERNALS UPGRADE NOTES
440440
2. The PHP_CHECK_GCC_ARG() m4 macro has been removed in favor of
441441
AX_CHECK_COMPILE_FLAG().
442442

443+
3. The 6th argument of PHP_ADD_SOURCES_X has been removed.
444+
445+
4. The 'special-flags' (3rd) argument of PHP_ADD_SOURCES_X are
446+
now appended instead of prepended to previous compiler flags.
447+
This means compiler flags passed to PHP_NEW_EXTENSION and PHP_ADD_SOURCES
448+
are now appended, this allows to disable compiler flags set by Zend/Zend.m4
449+
(e.g. disable certain compiler flags enabled by -Wextra)
450+
443451
c. Windows build system changes
444452

445453
- The configuration option --enable-crt-debug has been removed. The VC

Zend/tests/015.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ var_dump(trigger_error("error", E_USER_DEPRECATED));
2323
--EXPECTF--
2424
Notice: error in %s on line %d
2525
bool(true)
26-
trigger_error(): Argument #2 ($error_type) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
27-
trigger_error(): Argument #2 ($error_type) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
26+
trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
27+
trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
2828

2929
Warning: error in %s on line %d
3030
bool(true)

Zend/tests/attributes/005_objects.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ try {
9696
}
9797

9898
?>
99-
--EXPECT--
99+
--EXPECTF--
100100
string(2) "A1"
101101
string(4) "test"
102102
int(50)
103103

104104
string(7) "ERROR 1"
105-
string(81) "Too few arguments to function A1::__construct(), 0 passed and at least 1 expected"
105+
string(%d) "Too few arguments to function A1::__construct(), 0 passed in %s005_objects.php on line 26 and at least 1 expected"
106106

107107
string(7) "ERROR 2"
108-
string(74) "A1::__construct(): Argument #1 ($name) must be of type string, array given"
108+
string(%d) "A1::__construct(): Argument #1 ($name) must be of type string, array given, called in %s005_objects.php on line 36"
109109

110110
string(7) "ERROR 3"
111111
string(30) "Attribute class "A2" not found"
Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
11
--TEST--
2-
Attributes cannot be applied to groups of class constants.
2+
Attributes can be applied to groups of class constants
33
--FILE--
44
<?php
55

6-
class C1
6+
class C
77
{
8-
#[A1]
8+
#[A(1, X)]
99
public const A = 1, B = 2;
1010
}
1111

12+
const X = 2;
13+
14+
$rp1 = new ReflectionClassConstant('C', 'A');
15+
$ra1 = $rp1->getAttributes()[0];
16+
var_dump($ra1->getName(), $ra1->getArguments());
17+
$rp2 = new ReflectionClassConstant('C', 'B');
18+
$ra2 = $rp2->getAttributes()[0];
19+
var_dump($ra2->getName(), $ra2->getArguments());
20+
1221
?>
13-
--EXPECTF--
14-
Fatal error: Cannot apply attributes to a group of constants in %s
22+
--EXPECT--
23+
string(1) "A"
24+
array(2) {
25+
[0]=>
26+
int(1)
27+
[1]=>
28+
int(2)
29+
}
30+
string(1) "A"
31+
array(2) {
32+
[0]=>
33+
int(1)
34+
[1]=>
35+
int(2)
36+
}
Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
11
--TEST--
2-
Attributes cannot be applied to groups of properties.
2+
Attributes can be applied to groups of properties
33
--FILE--
44
<?php
55

6-
class C1
6+
class C
77
{
8-
#[A1]
8+
#[A(1, X)]
99
public $x, $y;
1010
}
1111

12+
const X = 2;
13+
14+
$rp1 = new ReflectionProperty('C', 'x');
15+
$ra1 = $rp1->getAttributes()[0];
16+
var_dump($ra1->getName(), $ra1->getArguments());
17+
$rp2 = new ReflectionProperty('C', 'y');
18+
$ra2 = $rp2->getAttributes()[0];
19+
var_dump($ra2->getName(), $ra2->getArguments());
20+
1221
?>
13-
--EXPECTF--
14-
Fatal error: Cannot apply attributes to a group of properties in %s
22+
--EXPECT--
23+
string(1) "A"
24+
array(2) {
25+
[0]=>
26+
int(1)
27+
[1]=>
28+
int(2)
29+
}
30+
string(1) "A"
31+
array(2) {
32+
[0]=>
33+
int(1)
34+
[1]=>
35+
int(2)
36+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
#[MyAttribute("42")]
5+
class TestStrict {}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
strict_types=1 of the attribute use-site is respected
3+
--FILE--
4+
<?php
5+
6+
#[Attribute]
7+
class MyAttribute {
8+
public function __construct(public int $value) {}
9+
}
10+
11+
#[MyAttribute("42")]
12+
class TestWeak {}
13+
14+
require __DIR__ . '/030_strict_types.inc';
15+
16+
var_dump((new ReflectionClass(TestWeak::class))->getAttributes()[0]->newInstance());
17+
var_dump((new ReflectionClass(TestStrict::class))->getAttributes()[0]->newInstance());
18+
19+
?>
20+
--EXPECTF--
21+
object(MyAttribute)#1 (1) {
22+
["value"]=>
23+
int(42)
24+
}
25+
26+
Fatal error: Uncaught TypeError: MyAttribute::__construct(): Argument #1 ($value) must be of type int, string given, called in %s030_strict_types.inc on line 4 and defined in %s030_strict_types.php:5
27+
Stack trace:
28+
#0 %s030_strict_types.inc(4): MyAttribute->__construct('42')
29+
#1 %s(%d): ReflectionAttribute->newInstance()
30+
#2 {main}
31+
thrown in %s on line %d
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
--TEST--
2+
Backtrace during attribute instance creation
3+
--FILE--
4+
<?php
5+
6+
#[Attribute]
7+
class MyAttribute {
8+
public function __construct() {
9+
debug_print_backtrace();
10+
var_dump(debug_backtrace());
11+
var_dump((new Exception)->getTrace());
12+
}
13+
}
14+
15+
#[MyAttribute]
16+
class Test {}
17+
18+
(new ReflectionClass(Test::class))->getAttributes()[0]->newInstance();
19+
20+
?>
21+
--EXPECTF--
22+
#0 MyAttribute->__construct() called at [%s031_backtrace.php:12]
23+
#1 ReflectionAttribute->newInstance() called at [%s:%d]
24+
array(2) {
25+
[0]=>
26+
array(7) {
27+
["file"]=>
28+
string(%d) "%s031_backtrace.php"
29+
["line"]=>
30+
int(12)
31+
["function"]=>
32+
string(11) "__construct"
33+
["class"]=>
34+
string(11) "MyAttribute"
35+
["object"]=>
36+
object(MyAttribute)#1 (0) {
37+
}
38+
["type"]=>
39+
string(2) "->"
40+
["args"]=>
41+
array(0) {
42+
}
43+
}
44+
[1]=>
45+
array(7) {
46+
["file"]=>
47+
string(%d) "%s"
48+
["line"]=>
49+
int(%d)
50+
["function"]=>
51+
string(11) "newInstance"
52+
["class"]=>
53+
string(19) "ReflectionAttribute"
54+
["object"]=>
55+
object(ReflectionAttribute)#2 (0) {
56+
}
57+
["type"]=>
58+
string(2) "->"
59+
["args"]=>
60+
array(0) {
61+
}
62+
}
63+
}
64+
array(2) {
65+
[0]=>
66+
array(6) {
67+
["file"]=>
68+
string(%d) "%s031_backtrace.php"
69+
["line"]=>
70+
int(12)
71+
["function"]=>
72+
string(11) "__construct"
73+
["class"]=>
74+
string(11) "MyAttribute"
75+
["type"]=>
76+
string(2) "->"
77+
["args"]=>
78+
array(0) {
79+
}
80+
}
81+
[1]=>
82+
array(6) {
83+
["file"]=>
84+
string(%d) "%s"
85+
["line"]=>
86+
int(%d)
87+
["function"]=>
88+
string(11) "newInstance"
89+
["class"]=>
90+
string(19) "ReflectionAttribute"
91+
["type"]=>
92+
string(2) "->"
93+
["args"]=>
94+
array(0) {
95+
}
96+
}
97+
}

Zend/tests/bug70914.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ try {
1818
}
1919
?>
2020
--EXPECT--
21-
PDOStatement::fetchObject(): Argument #1 ($class_name) must be a valid class name, %Z given
21+
PDOStatement::fetchObject(): Argument #1 ($class) must be a valid class name, %Z given

Zend/tests/bug75290.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var_dump(function ($someThing) {});
1212
object(Closure)#2 (1) {
1313
["parameter"]=>
1414
array(1) {
15-
["$number"]=>
15+
["$num"]=>
1616
string(10) "<required>"
1717
}
1818
}

Zend/tests/bug79783.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Bug #79783: Segfault in php_str_replace_common
55
str_replace("a", "b", "c", strlen("d"));
66
?>
77
--EXPECTF--
8-
Fatal error: Uncaught Error: str_replace(): Argument #4 ($replace_count) cannot be passed by reference in %s:%d
8+
Fatal error: Uncaught Error: str_replace(): Argument #4 ($count) cannot be passed by reference in %s:%d
99
Stack trace:
1010
#0 {main}
1111
thrown in %s on line %d

Zend/tests/bug79897.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,27 @@ class B {
1212

1313
class A {
1414
public function __construct(
15-
#[B(12)] public $b
15+
#[B(12, X)] public $b
1616
)
1717
{
1818
}
1919
}
2020

21+
const X = 42;
22+
2123
var_dump((new ReflectionParameter(['A', '__construct'], 'b'))->getAttributes()[0]->getArguments());
2224
var_dump((new ReflectionProperty('A', 'b'))->getAttributes()[0]->getArguments());
2325
?>
2426
--EXPECT--
25-
array(1) {
27+
array(2) {
2628
[0]=>
2729
int(12)
30+
[1]=>
31+
int(42)
2832
}
29-
array(1) {
33+
array(2) {
3034
[0]=>
3135
int(12)
36+
[1]=>
37+
int(42)
3238
}

0 commit comments

Comments
 (0)