Skip to content
forked from php/php-src

Commit 725f0ef

Browse files
authored
Merge pull request #9 from php/master
sync
2 parents dd61db7 + 33e9049 commit 725f0ef

File tree

459 files changed

+25052
-5912
lines changed

Some content is hidden

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

459 files changed

+25052
-5912
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ jobs:
7070
include:
7171
- env: ENABLE_ZTS=0 ENABLE_DEBUG=0
7272
arch: amd64
73+
if: type = cron
7374
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1
7475
arch: amd64
76+
if: type = cron
7577
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
7678
arch: arm64
7779
if: type = cron

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.1.0alpha1
44

5+
- Core:
6+
. Fixed inclusion order for phpize builds on Windows. (cmb)
7+
. Added missing hashtable insertion APIs for arr/obj/ref. (Sara)
8+
59
- FTP:
610
. Convert resource<ftp> to object \FTPConnection. (Sara)
711

UPGRADING

+38-1
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,49 @@ PHP 8.1 UPGRADE NOTES
1919
1. Backward Incompatible Changes
2020
========================================
2121

22+
- MySQLi:
23+
. mysqli_fetch_fields() and mysqli_fetch_field_direct() will now always return
24+
zero for max_length. You can compute this information by iterating over the
25+
result set and taking the maximum length. This is what PHP was doing
26+
internally previously.
27+
. The MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH option no longer has an effect.
28+
. The MYSQLI_STORE_RESULT_COPY_DATA option no longer has an effect.
29+
30+
- MySQLnd:
31+
. The mysqlnd.fetch_copy_data ini setting has been removed. However, this
32+
should not result in user-visible behavior changes.
33+
34+
- Standard:
35+
. version_compare() no longer accepts undocumented operator abbreviations.
36+
2237
========================================
2338
2. New Features
2439
========================================
2540

2641
- hash:
27-
. Added MurmurHash3 with streaming support. The following variants are implemented
42+
. The following functions have changed signatures:
43+
44+
- function hash(string $algo, string $data, bool $binary = false, array $options = []): string|false {}
45+
- function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}
46+
- function hash_init(string $algo, int $flags = 0, string $key = "", array $options = []): HashContext {}
47+
48+
The additional `$options` argument can be used to pass algorithm specific data.
49+
50+
. Added MurmurHash3 with streaming support. The following variants are implemented:
2851

2952
- murmur3a, 32-bit hash
3053
- murmur3c, 128-bit hash for x86
3154
- murmur3f, 128-bit hash for x64
3255

56+
The initial hash state can be passed through the `seed` key in the `$options` array, for example:
57+
58+
```php
59+
$h = hash("murmur3f", $data, options: ["seed" => 42]);
60+
echo $h, "\n";
61+
```
62+
63+
A valid seed value is within the range from 0 to the plaform defined UINT_MAX, usually 4294967295.
64+
3365
========================================
3466
3. Changes in SAPI modules
3567
========================================
@@ -61,6 +93,11 @@ PHP 8.1 UPGRADE NOTES
6193
- OpenSSL:
6294
. The OpenSSL extension now requires at least OpenSSL version 1.0.2.
6395

96+
- Standard:
97+
. --with-password-argon2 now uses pkg-config to detect libargon2. As such,
98+
an alternative libargon2 location should now be specified using
99+
PKG_CONFIG_PATH.
100+
64101
========================================
65102
10. New Global Constants
66103
========================================

UPGRADING.INTERNALS

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PHP 8.1 INTERNALS UPGRADE NOTES
55
2. Build system changes
66

77
3. Module changes
8+
a. ext/hash
89

910
========================
1011
1. Internal API changes
@@ -17,3 +18,10 @@ PHP 8.1 INTERNALS UPGRADE NOTES
1718
========================
1819
3. Module changes
1920
========================
21+
22+
a. ext/hash
23+
- The init signatures are extended with an additional `HashTable*`
24+
argument. The passed HT is to contain the algorithm specific
25+
configuration. If the an algorithm doesn't make use of any
26+
additional configuration, the argument is to be marked with
27+
ZEND_ATTRIBUTE_UNUSED.

Zend/Zend.m4

-6
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ dnl LIBZEND_OTHER_CHECKS
190190
dnl
191191
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
192192
193-
AC_ARG_ENABLE([zts],
194-
[AS_HELP_STRING([--enable-zts],
195-
[Enable thread safety])],
196-
[ZEND_ZTS=$enableval],
197-
[ZEND_ZTS=no])
198-
199193
AC_MSG_CHECKING(whether to enable thread-safety)
200194
AC_MSG_RESULT($ZEND_ZTS)
201195
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--TEST--
2+
Validation for "Attribute" does not use a scope when evaluating constant ASTs
3+
--FILE--
4+
<?php
5+
#[Attribute(parent::x)]
6+
class x extends y {}
7+
?>
8+
--EXPECTF--
9+
Fatal error: Cannot access "parent" when no class scope is active in %s on line %d

Zend/tests/bug70630.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ $x = (new ReflectionFunction("substr"))->getClosure();
77
$x->call(new a);
88
?>
99
--EXPECTF--
10-
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
10+
Warning: Cannot rebind scope of closure created from function in %s on line %d

Zend/tests/bug70685.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ var_dump($c);
1818
Warning: Cannot bind method SplDoublyLinkedList::count() to object of class cls in %s on line %d
1919
NULL
2020

21-
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
21+
Warning: Cannot rebind scope of closure created from method in %s on line %d
2222
NULL

Zend/tests/bug80391.phpt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Iterable not covariant to mixed
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
public function method1(): mixed {}
8+
public function method2(): array|object {}
9+
public function method3(iterable $x) {}
10+
public function method4(iterable $x) {}
11+
}
12+
13+
class B extends A {
14+
public function method1(): iterable {}
15+
public function method2(): iterable {}
16+
public function method3(mixed $x) {}
17+
public function method4(array|object $x) {}
18+
}
19+
20+
?>
21+
===DONE===
22+
--EXPECT--
23+
===DONE===

Zend/tests/bug80404.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #80404: Incorrect range inference result when division results in float
3+
--FILE--
4+
<?php
5+
6+
$n = 63;
7+
var_dump((int) ($n / 120 * 100));
8+
9+
?>
10+
--EXPECT--
11+
int(52)

Zend/tests/closure_061.phpt

+12-12
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ bindTo(new Cls, null):
118118
Success!
119119

120120
bindTo(new Cls, Cls::class):
121-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
121+
Cannot rebind scope of closure created from function
122122

123123
bindTo(null, Cls::class):
124-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
124+
Cannot rebind scope of closure created from function
125125

126126
bindTo(null, stdClass::class):
127127
Cannot bind closure to scope of internal class stdClass
@@ -139,10 +139,10 @@ bindTo(new Cls, null):
139139
Success!
140140

141141
bindTo(new Cls, Cls::class):
142-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
142+
Cannot rebind scope of closure created from function
143143

144144
bindTo(null, Cls::class):
145-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
145+
Cannot rebind scope of closure created from function
146146

147147
bindTo(null, stdClass::class):
148148
Cannot bind closure to scope of internal class stdClass
@@ -163,13 +163,13 @@ bindTo(new Cls, Cls::class):
163163
Cannot bind an instance to a static closure
164164

165165
bindTo(null, null):
166-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
166+
Cannot rebind scope of closure created from method
167167

168168
bindTo(null, ClsChild::class):
169-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
169+
Cannot rebind scope of closure created from method
170170

171171
bindTo(null, ClsUnrelated::class):
172-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
172+
Cannot rebind scope of closure created from method
173173

174174
(new Cls)->method()
175175
-------------------
@@ -187,13 +187,13 @@ bindTo(new ClsUnrelated, Cls::class):
187187
Cannot bind method Cls::method() to object of class ClsUnrelated
188188

189189
bindTo(new Cls, null):
190-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
190+
Cannot rebind scope of closure created from method
191191

192192
bindTo(new Cls, ClsUnrelated::class):
193-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
193+
Cannot rebind scope of closure created from method
194194

195195
bindTo(new Cls, ClsChild::class):
196-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
196+
Cannot rebind scope of closure created from method
197197

198198
(new SplDoublyLinkedList)->count()
199199
----------------------------------
@@ -214,10 +214,10 @@ bindTo(null, SplDoublyLinkedList::class):
214214
Cannot unbind $this of method
215215

216216
bindTo(new SplDoublyLinkedList, null):
217-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
217+
Cannot rebind scope of closure created from method
218218

219219
bindTo(new SplDoublyLinkedList, ClsUnrelated::class):
220-
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
220+
Cannot rebind scope of closure created from method
221221

222222
(function() {})()
223223
-----------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
GC on running generator
3+
--FILE--
4+
<?php
5+
6+
function gen() {
7+
yield;
8+
// Trigger GC while $v is being reassigned.
9+
$ary = [new stdClass, new stdClass, new stdClass];
10+
$ary[0]->foo = $ary;
11+
foreach ($ary as &$v) { }
12+
}
13+
14+
for ($i = 0; $i < 10000; $i++) {
15+
// Make sure gen is registered as a GC root.
16+
$gen = gen();
17+
$gen2 = $gen;
18+
unset($gen);
19+
foreach ($gen2 as $v) {}
20+
}
21+
22+
?>
23+
===DONE===
24+
--EXPECT--
25+
===DONE===

Zend/tests/live_range_phi_leak.phpt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Missing live range if part of phi
3+
--FILE--
4+
<?php
5+
function doThrow() {
6+
throw new Exception("Test");
7+
}
8+
function test($k) {
9+
// The 0 gives the QM_ASSIGN a non-refcounted type.
10+
$res[$k ? $k : 0] = doThrow();
11+
}
12+
try {
13+
test(new stdClass);
14+
} catch (Exception $e) {
15+
echo $e->getMessage(), "\n";
16+
}
17+
?>
18+
--EXPECT--
19+
Test

Zend/tests/lsb_023.phpt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Late Static Binding static:: calls protected / public method of child class even then
3+
the method is private in parent class
4+
--FILE--
5+
<?php
6+
class A {
7+
public static function out() {
8+
echo static::value(), PHP_EOL;
9+
}
10+
11+
private static function value() { return 'A'; }
12+
}
13+
class B extends A {
14+
protected static function value() { return 'B'; }
15+
}
16+
class C extends A {
17+
public static function value() { return 'C'; }
18+
}
19+
A::out();
20+
B::out();
21+
C::out();
22+
echo PHP_EOL;
23+
--EXPECT--
24+
A
25+
B
26+
C

Zend/tests/lsb_024.phpt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Late Static Binding static:: accesses protected / public static variables of child
3+
class when the variable is private in parent class
4+
--FILE--
5+
<?php
6+
class A {
7+
private static $value = 'A';
8+
9+
public static function out() {
10+
echo static::$value, PHP_EOL;
11+
}
12+
}
13+
class B extends A {
14+
protected static $value = 'B';
15+
}
16+
class C extends A {
17+
public static $value = 'C';
18+
}
19+
A::out();
20+
B::out();
21+
C::out();
22+
--EXPECT--
23+
A
24+
B
25+
C

Zend/tests/named_params/undef_var.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Passing undefined variabled to named arg
2+
Passing undefined variable to named arg
33
--FILE--
44
<?php
55

0 commit comments

Comments
 (0)