Skip to content

Commit 49b10ee

Browse files
committed
Merge branch 'master' into merge-fastcgi
2 parents 9f1788f + 770a462 commit 49b10ee

File tree

79 files changed

+3088
-1147
lines changed

Some content is hidden

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

79 files changed

+3088
-1147
lines changed

NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
. Implemented the RFC `Constructor behaviour of internal classes`. (Dan, Dmitry)
7878
. Implemented the RFC `Fix "foreach" behavior`. (Dmitry)
7979
. Implemented the RFC `Generator Delegation`. (Bob)
80-
. Implemented the RFC ` Anonymous Class Support`. (Joe, Nikita, Dmitry)
80+
. Implemented the RFC `Anonymous Class Support`. (Joe, Nikita, Dmitry)
81+
. Implemented the RFC `Context Sensitive Lexer`. (Marcio Almada)
8182
. Fixed bug #69511 (Off-by-one buffer overflow in php_sys_readlink).
8283
(Jan Starke, Anatol)
8384

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ Other
530530
(RFC: https://wiki.php.net/rfc/combined-comparison-operator)
531531
. Added the yield from operator for delegating Generators like coroutines.
532532
(RFC: https://wiki.php.net/rfc/generator-delegation)
533+
. Reserved keywords can now be used in various new contexts.
534+
(RFC: https://wiki.php.net/rfc/context_sensitive_lexer)
533535

534536
- OpenSSL
535537
. Added "alpn_protocols" SSL context option allowing encrypted client/server
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Test to check static method calls syntax regression
3+
--FILE--
4+
<?php
5+
6+
class Foo {
7+
public static function function(){ echo __METHOD__, PHP_EOL; }
8+
}
9+
10+
Foo::function();
11+
12+
Foo::
13+
function();
14+
15+
Foo::
16+
function();
17+
18+
19+
Foo::
20+
function(
21+
22+
);
23+
24+
echo "\nDone\n";
25+
26+
--EXPECTF--
27+
28+
Foo::function
29+
Foo::function
30+
Foo::function
31+
Foo::function
32+
33+
Done
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Test to ensure ::class still works
3+
--FILE--
4+
<?php
5+
6+
class Foo {}
7+
8+
var_dump(Foo::class);
9+
10+
var_dump(Foo:: class);
11+
12+
var_dump(Foo:: CLASS);
13+
14+
var_dump(Foo::
15+
16+
CLASS);
17+
18+
--EXPECTF--
19+
string(3) "Foo"
20+
string(3) "Foo"
21+
string(3) "Foo"
22+
string(3) "Foo"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Test to ensure ::class is still reserved in obj scope
3+
--FILE--
4+
<?php
5+
6+
class Obj
7+
{
8+
const CLASS = 'class';
9+
}
10+
11+
?>
12+
--EXPECTF--
13+
Fatal error: A class constant must not be called 'class'; it is reserved for class name fetching in %s on line %d
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Test possible function naming regression on procedural scope
3+
--FILE--
4+
<?php
5+
6+
class Obj
7+
{
8+
function echo(){} // valid
9+
function return(){} // valid
10+
}
11+
12+
function echo(){} // not valid
13+
14+
--EXPECTF--
15+
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting identifier (T_STRING) or '(' in %s on line 9
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Test possible constant naming regression on procedural scope
3+
--FILE--
4+
<?php
5+
6+
class Obj
7+
{
8+
const return = 'yep';
9+
}
10+
11+
const return = 'nope';
12+
13+
--EXPECTF--
14+
Parse error: syntax error, unexpected 'return' (T_RETURN), expecting identifier (T_STRING) in %s on line 8
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Test to ensure const list syntax declaration works
3+
--FILE--
4+
<?php
5+
6+
class Obj
7+
{
8+
const DECLARE = 'declare',
9+
RETURN = 'return',
10+
FUNCTION = 'function',
11+
USE = 'use';
12+
}
13+
14+
echo Obj::DECLARE, PHP_EOL;
15+
echo Obj::RETURN, PHP_EOL;
16+
echo Obj::FUNCTION, PHP_EOL;
17+
echo Obj::USE, PHP_EOL;
18+
echo Obj::
19+
20+
USE, PHP_EOL;
21+
echo "\nDone\n";
22+
23+
--EXPECTF--
24+
declare
25+
return
26+
function
27+
use
28+
use
29+
30+
Done
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
Test to ensure semi reserved words allow deference
3+
--FILE--
4+
<?php
5+
6+
class Foo {
7+
const use = 'yay';
8+
9+
public static function new() {
10+
echo __METHOD__, PHP_EOL;
11+
return new static();
12+
}
13+
14+
public function self() {
15+
echo __METHOD__, PHP_EOL;
16+
return $this;
17+
}
18+
}
19+
20+
Foo::new()::new()::new();
21+
22+
var_dump(
23+
(new Foo)->self()::new()->self()->self()::use
24+
);
25+
26+
Foo::{'new'}();
27+
28+
var_dump(Foo::use);
29+
30+
echo "\nDone\n";
31+
32+
--EXPECTF--
33+
Foo::new
34+
Foo::new
35+
Foo::new
36+
Foo::self
37+
Foo::new
38+
Foo::self
39+
Foo::self
40+
string(3) "yay"
41+
Foo::new
42+
string(3) "yay"
43+
44+
Done
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Test to check regressions on string interpolation with class members access
3+
--FILE--
4+
<?php
5+
6+
class Friday {
7+
public $require = "fun";
8+
}
9+
10+
$friday = new Friday;
11+
12+
echo "$friday->require ($friday->require) {$friday->require}", PHP_EOL;
13+
14+
echo "\nDone\n";
15+
16+
17+
--EXPECTF--
18+
19+
fun (fun) fun
20+
21+
Done
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Test to check regressions on use statements and lexer state
3+
--FILE--
4+
<?php
5+
6+
use A\B\C\D;
7+
8+
class Foo
9+
{
10+
private static $foo;
11+
12+
}
13+
14+
echo PHP_EOL, "Done", PHP_EOL;
15+
16+
--EXPECTF--
17+
18+
Done
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Test to check regressions on T_IMPLEMENTS followed by a T_NS_SEPARATOR
3+
--FILE--
4+
<?php
5+
6+
interface A{}
7+
8+
class B implements\A {}
9+
10+
echo "Done", PHP_EOL;
11+
12+
--EXPECTF--
13+
14+
Done
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Testing instantiation using namespace:: prefix
3+
--FILE--
4+
<?php
5+
6+
namespace foo;
7+
8+
class bar {
9+
}
10+
11+
class_alias('foo\bar', 'foo\baz');
12+
13+
var_dump(new namespace\baz);
14+
15+
?>
16+
--EXPECTF--
17+
object(foo\bar)#%d (0) {
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Testing for regression on const list syntax and arrays
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
const A = [1, FOREACH];
8+
}
9+
10+
?>
11+
--EXPECTF--
12+
13+
Parse error: syntax error, unexpected 'FOREACH' (T_FOREACH), expecting ']' in %s on line %d
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Testing for regression with encapsed variables in class declaration context
3+
--FILE--
4+
<?php
5+
6+
class A { function foo() { "{${$a}}"; } function list() {} }
7+
8+
echo "Done", PHP_EOL;
9+
10+
?>
11+
--EXPECTF--
12+
13+
Done

0 commit comments

Comments
 (0)