Skip to content

Commit 3f52368

Browse files
Merge pull request #3 from php/master
Update fork
2 parents 37cf534 + 555e7ec commit 3f52368

File tree

362 files changed

+9287
-17491
lines changed

Some content is hidden

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

362 files changed

+9287
-17491
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
arch: amd64
7575
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
7676
arch: arm64
77+
if: type = cron
7778
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 S390X=1
7879
arch: s390x
7980
if: type = cron

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77
- Core:
88
. Fixed bug #80109 (Cannot skip arguments when extended debug is enabled).
99
(Nikita)
10+
- SPL:
11+
. SplFixedArray is now IteratorAggregate rather than Iterator. (alexdowad)
1012

1113
17 Sep 2020, PHP 8.0.0beta4
1214

UPGRADING

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ PHP 8.0 UPGRADE NOTES
325325
. iconv() implementations which do not properly set errno in case of errors
326326
are no longer supported.
327327

328+
- IMAP:
329+
. The unused default_host argument of imap_headerinfo() has been removed.
330+
. The imap_header() function which is an alias of imap_headerinfo() has been removed.
331+
328332
- Intl:
329333
. The deprecated constant INTL_IDNA_VARIANT_2003 has been removed.
330334
RFC: https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003
@@ -431,6 +435,8 @@ PHP 8.0 UPGRADE NOTES
431435
. The deprecated pg_lo_import() and pg_lo_export() signature that passes the
432436
connection as the last argument is no longer supported. The connection
433437
should be passed as first argument instead.
438+
. pg_fetch_all() will now return an empty array instead of false for result
439+
sets with zero rows.
434440

435441
- Phar:
436442
. Metadata associated with a phar will no longer be automatically unserialized,
@@ -496,6 +502,12 @@ PHP 8.0 UPGRADE NOTES
496502
. spl_autoload_register() will now always throw a TypeError on invalid
497503
arguments, therefore the second argument $do_throw is ignored and a
498504
notice will be emitted if it is set to false.
505+
. SplFixedArray is now an IteratorAggregate and not an Iterator.
506+
SplFixedArray::rewind(), ::current(), ::key(), ::next(), and ::valid()
507+
have been removed. In their place, SplFixedArray::getIterator() has been
508+
added. Any code which uses explicit iteration over SplFixedArray must now
509+
obtain an Iterator through SplFixedArray::getIterator(). This means that
510+
SplFixedArray is now safe to use in nested loops.
499511

500512
- Standard:
501513
. assert() will no longer evaluate string arguments, instead they will be
@@ -844,6 +856,7 @@ PHP 8.0 UPGRADE NOTES
844856
- PGSQL / PDO PGSQL:
845857
. The constant PG_VERSION_STR has now the same value as PG_VERSION, and thus
846858
is deprecated.
859+
. Function aliases in the pgsql extension have been deprecated.
847860

848861
- Zip:
849862
. Using empty file as ZipArchive is deprecated. Libzip 1.6.0

UPGRADING.INTERNALS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,14 @@ PHP 8.0 INTERNALS UPGRADE NOTES
369369
- zend_stack_is_empty()
370370
- zend_ts_hash_exists()
371371
- zend_ts_hash_index_exists()
372+
9. Argument void to const char* in Zend Engine 4.0:
373+
- zend_get_op_array_extension_handle()
374+
10. Argument zend_extension to const char* in Zend Engine 4.0:
375+
- zend_get_resource_handle()
376+
11. Argument const char * to HMODULE in Zend Engine 4.0:
377+
- php_win32_image_compatible()
378+
12. const char * argument dropped in Zend Engine 4.0:
379+
- php_win32_crt_compatible()
372380

373381
u. Instead of overwriting zend_error_cb extensions with debugging, monitoring
374382
use-cases catching Errors/Exceptions are strongly encouraged to use

Zend/tests/008.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ echo "Done\n";
3232
--EXPECTF--
3333
TypeError: define(): Argument #1 ($constant_name) must be of type string, array given
3434

35-
Notice: Constant TRUE already defined in %s on line %d
35+
Warning: Constant TRUE already defined in %s on line %d
3636
bool(false)
3737
bool(true)
3838
bool(true)
3939
bool(true)
4040

41-
Notice: Constant test const already defined in %s on line %d
41+
Warning: Constant test const already defined in %s on line %d
4242
bool(false)
4343
bool(true)
4444
bool(true)

Zend/tests/009.phpt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ $f2 = new foo2;
2626
$f1->bar();
2727
$f2->bar();
2828

29-
var_dump(get_class());
29+
try {
30+
var_dump(get_class());
31+
} catch (Error $e) {
32+
echo $e->getMessage(), "\n";
33+
}
3034
try {
3135
var_dump(get_class("qwerty"));
3236
} catch (TypeError $e) {
@@ -40,12 +44,10 @@ $f1->testNull();
4044

4145
echo "Done\n";
4246
?>
43-
--EXPECTF--
47+
--EXPECT--
4448
string(3) "foo"
4549
string(3) "foo"
46-
47-
Warning: get_class() called without object from outside a class in %s on line %d
48-
bool(false)
50+
get_class() without arguments must be called from within a class
4951
get_class(): Argument #1 ($object) must be of type object, string given
5052
string(3) "foo"
5153
string(4) "foo2"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--TEST--
2+
Test default value handling of ErrorException::__construct()
3+
--FILE--
4+
<?php
5+
6+
$e = new ErrorException();
7+
var_dump($e->getMessage());
8+
var_dump($e->getFile());
9+
var_dump($e->getLine());
10+
11+
$e = new ErrorException("Second", 0, E_ERROR, null);
12+
var_dump($e->getMessage());
13+
var_dump($e->getFile());
14+
var_dump($e->getLine());
15+
16+
$e = new ErrorException("Third", 0, E_ERROR, null, null);
17+
var_dump($e->getMessage());
18+
var_dump($e->getFile());
19+
var_dump($e->getLine());
20+
21+
$e = new ErrorException("Forth", 0, E_ERROR, null, 123);
22+
var_dump($e->getMessage());
23+
var_dump($e->getFile());
24+
var_dump($e->getLine());
25+
26+
$e = new ErrorException("Fifth", 0, E_ERROR, "abc.php");
27+
var_dump($e->getMessage());
28+
var_dump($e->getFile());
29+
var_dump($e->getLine());
30+
31+
$e = new ErrorException("Sixth", 0, E_ERROR, "abc.php", null);
32+
var_dump($e->getMessage());
33+
var_dump($e->getFile());
34+
var_dump($e->getLine());
35+
36+
$e = new ErrorException("Seventh", 0, E_ERROR, "abc.php", 123);
37+
var_dump($e->getMessage());
38+
var_dump($e->getFile());
39+
var_dump($e->getLine());
40+
41+
?>
42+
--EXPECTF--
43+
string(0) ""
44+
string(%d) "%sErrorException_construct.php"
45+
int(3)
46+
string(6) "Second"
47+
string(%d) "%sErrorException_construct.php"
48+
int(8)
49+
string(5) "Third"
50+
string(%d) "%sErrorException_construct.php"
51+
int(13)
52+
string(5) "Forth"
53+
string(%d) "%sErrorException_construct.php"
54+
int(123)
55+
string(5) "Fifth"
56+
string(7) "abc.php"
57+
int(0)
58+
string(5) "Sixth"
59+
string(7) "abc.php"
60+
int(0)
61+
string(7) "Seventh"
62+
string(7) "abc.php"
63+
int(123)

Zend/tests/attributes/004_name_resolution.phpt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
Resolve attribute names
33
--FILE--
44
<?php
5-
function dump_attributes($attributes) {
6-
$arr = [];
7-
foreach ($attributes as $attribute) {
8-
$arr[] = ['name' => $attribute->getName(), 'args' => $attribute->getArguments()];
5+
6+
namespace {
7+
function dump_attributes($attributes) {
8+
$arr = [];
9+
foreach ($attributes as $attribute) {
10+
$arr[] = ['name' => $attribute->getName(), 'args' => $attribute->getArguments()];
11+
}
12+
var_dump($arr);
913
}
10-
var_dump($arr);
1114
}
1215

1316
namespace Doctrine\ORM\Mapping {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
Reflect attributes on different kinds of internal symbols
3+
--FILE--
4+
<?php
5+
6+
$rf = new ReflectionFunction('unserialize');
7+
var_dump($rf->getAttributes());
8+
9+
$rc = new ReflectionClass('DateTime');
10+
var_dump($rc->getAttributes());
11+
12+
$rm = $rc->getMethod('__construct');
13+
var_dump($rm->getAttributes());
14+
15+
$rcc = $rc->getReflectionConstant('ATOM');
16+
var_dump($rcc->getAttributes());
17+
18+
$rp = new ReflectionProperty('Exception', 'message');
19+
var_dump($rp->getAttributes());
20+
21+
?>
22+
--EXPECT--
23+
array(0) {
24+
}
25+
array(0) {
26+
}
27+
array(0) {
28+
}
29+
array(0) {
30+
}
31+
array(0) {
32+
}

Zend/tests/bug33999.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ object(Foo)#1 (1) {
2323
string(3) "bat"
2424
}
2525

26-
Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9
26+
Warning: Object of class Foo could not be converted to int in %s on line %d
2727
int(1)
2828

29-
Notice: Object of class Foo could not be converted to float in %sbug33999.php on line 12
29+
Warning: Object of class Foo could not be converted to float in %s on line %d
3030
float(1)

Zend/tests/bug47054.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ C::s();
2222
$c = new C();
2323
$c->s();
2424

25-
get_called_class();
26-
2725
?>
28-
--EXPECTF--
26+
--EXPECT--
2927
Called class: D
3028
Called class: C
3129
Called class: C
32-
33-
Warning: get_called_class() called from outside a class in %s on line %d

Zend/tests/bug53305.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ var_dump(constant('__COMPILER_HALT_OFFSET__1'.chr(0)));
1414

1515
?>
1616
--EXPECTF--
17-
Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
17+
Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
1818
int(1)
1919
int(4)

Zend/tests/cast_to_double.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ float(1)
5252
float(0)
5353
float(%f)
5454

55-
Notice: Object of class test could not be converted to float in %s on line %d
55+
Warning: Object of class test could not be converted to float in %s on line %d
5656
float(1)
5757
Done

Zend/tests/cast_to_int.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ int(1)
5050
int(0)
5151
int(%d)
5252

53-
Notice: Object of class test could not be converted to int in %s on line %d
53+
Warning: Object of class test could not be converted to int in %s on line %d
5454
int(1)
5555
Done

Zend/tests/closure_040.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ $a = new A(20);
2424
$ca = $a->getIncrementor();
2525
$cas = $a->getStaticIncrementor();
2626

27-
$ca->bindTo($a, array());
27+
try {
28+
$ca->bindTo($a, array());
29+
} catch (TypeError $e) {
30+
echo $e->getMessage(), "\n";
31+
}
2832

2933
$cas->bindTo($a, 'A');
3034

3135
?>
3236
--EXPECTF--
33-
Warning: Array to string conversion in %s on line %d
34-
35-
Warning: Class "Array" not found in %s on line %d
37+
Closure::bindTo(): Argument #2 ($newScope) must be of type object|string|null, array given
3638

3739
Warning: Cannot bind an instance to a static closure in %s on line %d

Zend/tests/constants_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var_dump(constant('1foo'));
1717

1818
?>
1919
--EXPECTF--
20-
Notice: Constant 1 already defined in %s on line %d
20+
Warning: Constant 1 already defined in %s on line %d
2121
int(2)
2222
int(2)
2323
int(2)

Zend/tests/constants_004.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ const foo = 2;
1010

1111
?>
1212
--EXPECTF--
13-
Notice: Constant foo\foo already defined in %s on line %d
13+
Warning: Constant foo\foo already defined in %s on line %d

Zend/tests/constants_008.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ if (defined('a')) {
1313

1414
?>
1515
--EXPECTF--
16-
Notice: Constant a already defined in %s on line %d
16+
Warning: Constant a already defined in %s on line %d
1717
2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Function declaration should not be allowed before namespace declaration
3+
--FILE--
4+
<?php
5+
6+
function foo() {}
7+
8+
namespace Bar;
9+
10+
?>
11+
--EXPECTF--
12+
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in %s on line %d

Zend/tests/generators/errors/count_error.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ $gen = gen();
99

1010
try {
1111
count($gen);
12-
} catch (Exception $e) {
13-
echo $e;
12+
} catch (\TypeError $e) {
13+
echo $e->getMessage(), PHP_EOL;
1414
}
1515

1616
?>
17-
--EXPECTF--
18-
Warning: count(): Argument #1 ($var) must be of type Countable|array, Generator given in %s on line %d
17+
--EXPECT--
18+
count(): Argument #1 ($var) must be of type Countable|array, Generator given

Zend/tests/get_called_class_001.phpt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ Calling get_called_class() outside a class
33
--FILE--
44
<?php
55

6-
var_dump(get_called_class());
6+
try {
7+
var_dump(get_called_class());
8+
} catch (Error $e) {
9+
echo $e->getMessage(), "\n";
10+
}
711

812
?>
9-
--EXPECTF--
10-
Warning: get_called_class() called from outside a class in %s on line %d
11-
bool(false)
13+
--EXPECT--
14+
get_called_class() must be called from within a class

Zend/tests/get_class_vars_001.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class B extends A {
1919
var_dump(get_class_vars('A'));
2020
var_dump(get_class_vars('B'));
2121

22+
try {
23+
get_class_vars("Unknown");
24+
} catch (Error $e) {
25+
echo $e->getMessage(), "\n";
26+
}
27+
2228
?>
2329
--EXPECT--
2430
array(1) {
@@ -31,3 +37,4 @@ array(2) {
3137
["aa"]=>
3238
int(4)
3339
}
40+
get_class_vars(): Argument #1 ($class) must be a valid class name, Unknown given

Zend/tests/halt_compiler3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ __HALT_COMPILER(); bad define() of __COMPILER_HALT_OFFSET__ 1
55
define ('__COMPILER_HALT_OFFSET__', 1);
66
?>
77
--EXPECTF--
8-
Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
8+
Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d

0 commit comments

Comments
 (0)