Skip to content

Commit

Permalink
Merge branch 'master' into merge-fastcgi
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed May 26, 2015
2 parents 9f1788f + 770a462 commit 49b10ee
Show file tree
Hide file tree
Showing 79 changed files with 3,088 additions and 1,147 deletions.
3 changes: 2 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
. Implemented the RFC `Constructor behaviour of internal classes`. (Dan, Dmitry)
. Implemented the RFC `Fix "foreach" behavior`. (Dmitry)
. Implemented the RFC `Generator Delegation`. (Bob)
. Implemented the RFC ` Anonymous Class Support`. (Joe, Nikita, Dmitry)
. Implemented the RFC `Anonymous Class Support`. (Joe, Nikita, Dmitry)
. Implemented the RFC `Context Sensitive Lexer`. (Marcio Almada)
. Fixed bug #69511 (Off-by-one buffer overflow in php_sys_readlink).
(Jan Starke, Anatol)

Expand Down
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ Other
(RFC: https://wiki.php.net/rfc/combined-comparison-operator)
. Added the yield from operator for delegating Generators like coroutines.
(RFC: https://wiki.php.net/rfc/generator-delegation)
. Reserved keywords can now be used in various new contexts.
(RFC: https://wiki.php.net/rfc/context_sensitive_lexer)

- OpenSSL
. Added "alpn_protocols" SSL context option allowing encrypted client/server
Expand Down
33 changes: 33 additions & 0 deletions Zend/tests/grammar/regression_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
Test to check static method calls syntax regression
--FILE--
<?php

class Foo {
public static function function(){ echo __METHOD__, PHP_EOL; }
}

Foo::function();

Foo::
function();

Foo::
function();


Foo::
function(

);

echo "\nDone\n";

--EXPECTF--

Foo::function
Foo::function
Foo::function
Foo::function

Done
22 changes: 22 additions & 0 deletions Zend/tests/grammar/regression_002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test to ensure ::class still works
--FILE--
<?php

class Foo {}

var_dump(Foo::class);

var_dump(Foo:: class);

var_dump(Foo:: CLASS);

var_dump(Foo::

CLASS);

--EXPECTF--
string(3) "Foo"
string(3) "Foo"
string(3) "Foo"
string(3) "Foo"
13 changes: 13 additions & 0 deletions Zend/tests/grammar/regression_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Test to ensure ::class is still reserved in obj scope
--FILE--
<?php

class Obj
{
const CLASS = 'class';
}

?>
--EXPECTF--
Fatal error: A class constant must not be called 'class'; it is reserved for class name fetching in %s on line %d
15 changes: 15 additions & 0 deletions Zend/tests/grammar/regression_004.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Test possible function naming regression on procedural scope
--FILE--
<?php

class Obj
{
function echo(){} // valid
function return(){} // valid
}

function echo(){} // not valid

--EXPECTF--
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting identifier (T_STRING) or '(' in %s on line 9
14 changes: 14 additions & 0 deletions Zend/tests/grammar/regression_005.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
Test possible constant naming regression on procedural scope
--FILE--
<?php

class Obj
{
const return = 'yep';
}

const return = 'nope';

--EXPECTF--
Parse error: syntax error, unexpected 'return' (T_RETURN), expecting identifier (T_STRING) in %s on line 8
30 changes: 30 additions & 0 deletions Zend/tests/grammar/regression_006.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
Test to ensure const list syntax declaration works
--FILE--
<?php

class Obj
{
const DECLARE = 'declare',
RETURN = 'return',
FUNCTION = 'function',
USE = 'use';
}

echo Obj::DECLARE, PHP_EOL;
echo Obj::RETURN, PHP_EOL;
echo Obj::FUNCTION, PHP_EOL;
echo Obj::USE, PHP_EOL;
echo Obj::

USE, PHP_EOL;
echo "\nDone\n";

--EXPECTF--
declare
return
function
use
use

Done
44 changes: 44 additions & 0 deletions Zend/tests/grammar/regression_007.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--TEST--
Test to ensure semi reserved words allow deference
--FILE--
<?php

class Foo {
const use = 'yay';

public static function new() {
echo __METHOD__, PHP_EOL;
return new static();
}

public function self() {
echo __METHOD__, PHP_EOL;
return $this;
}
}

Foo::new()::new()::new();

var_dump(
(new Foo)->self()::new()->self()->self()::use
);

Foo::{'new'}();

var_dump(Foo::use);

echo "\nDone\n";

--EXPECTF--
Foo::new
Foo::new
Foo::new
Foo::self
Foo::new
Foo::self
Foo::self
string(3) "yay"
Foo::new
string(3) "yay"

Done
21 changes: 21 additions & 0 deletions Zend/tests/grammar/regression_008.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Test to check regressions on string interpolation with class members access
--FILE--
<?php

class Friday {
public $require = "fun";
}

$friday = new Friday;

echo "$friday->require ($friday->require) {$friday->require}", PHP_EOL;

echo "\nDone\n";


--EXPECTF--

fun (fun) fun

Done
18 changes: 18 additions & 0 deletions Zend/tests/grammar/regression_009.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Test to check regressions on use statements and lexer state
--FILE--
<?php

use A\B\C\D;

class Foo
{
private static $foo;

}

echo PHP_EOL, "Done", PHP_EOL;

--EXPECTF--

Done
14 changes: 14 additions & 0 deletions Zend/tests/grammar/regression_010.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
Test to check regressions on T_IMPLEMENTS followed by a T_NS_SEPARATOR
--FILE--
<?php

interface A{}

class B implements\A {}

echo "Done", PHP_EOL;

--EXPECTF--

Done
18 changes: 18 additions & 0 deletions Zend/tests/grammar/regression_011.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Testing instantiation using namespace:: prefix
--FILE--
<?php

namespace foo;

class bar {
}

class_alias('foo\bar', 'foo\baz');

var_dump(new namespace\baz);

?>
--EXPECTF--
object(foo\bar)#%d (0) {
}
13 changes: 13 additions & 0 deletions Zend/tests/grammar/regression_012.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Testing for regression on const list syntax and arrays
--FILE--
<?php

class A {
const A = [1, FOREACH];
}

?>
--EXPECTF--

Parse error: syntax error, unexpected 'FOREACH' (T_FOREACH), expecting ']' in %s on line %d
13 changes: 13 additions & 0 deletions Zend/tests/grammar/regression_013.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Testing for regression with encapsed variables in class declaration context
--FILE--
<?php

class A { function foo() { "{${$a}}"; } function list() {} }

echo "Done", PHP_EOL;

?>
--EXPECTF--

Done
Loading

0 comments on commit 49b10ee

Please sign in to comment.