-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from php/master
Merging upstream
- Loading branch information
Showing
42 changed files
with
646 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Closure must not leak during a dynamic call interrupted by an exception | ||
--FILE-- | ||
<?php | ||
|
||
(function() { | ||
$closure = function($foo) { var_dump($foo); }; | ||
$closure(yield); | ||
})()->valid(); // start | ||
|
||
?> | ||
==DONE== | ||
--EXPECT-- | ||
==DONE== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Indirect call with constants. | ||
--FILE-- | ||
<?php | ||
|
||
class Test | ||
{ | ||
public static function method() | ||
{ | ||
echo "Method called!\n"; | ||
} | ||
} | ||
|
||
['Test', 'method'](); | ||
|
||
'Test::method'(); | ||
|
||
(['Test', 'method'])(); | ||
|
||
('Test::method')(); | ||
|
||
?> | ||
--EXPECT-- | ||
Method called! | ||
Method called! | ||
Method called! | ||
Method called! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--TEST-- | ||
Indirect call with 'Class::method' syntax with class in namespace | ||
--FILE-- | ||
<?php | ||
namespace TestNamespace | ||
{ | ||
class TestClass | ||
{ | ||
public static function staticMethod() | ||
{ | ||
echo "Static method called!\n"; | ||
} | ||
|
||
public static function staticMethodWithArgs($arg1, $arg2, $arg3) | ||
{ | ||
printf("Static method called with args: %s, %s, %s\n", $arg1, $arg2, $arg3); | ||
} | ||
} | ||
} | ||
|
||
namespace CallNamespace | ||
{ | ||
// Test basic call using Class::method syntax. | ||
$callback = 'TestNamespace\TestClass::staticMethod'; | ||
$callback(); | ||
|
||
// Case should not matter. | ||
$callback = 'testnamespace\testclass::staticmethod'; | ||
$callback(); | ||
|
||
$args = ['arg1', 'arg2', 'arg3']; | ||
$callback = 'TestNamespace\TestClass::staticMethodWithArgs'; | ||
|
||
// Test call with args. | ||
$callback($args[0], $args[1], $args[2]); | ||
|
||
// Test call with splat operator. | ||
$callback(...$args); | ||
} | ||
?> | ||
--EXPECT-- | ||
Static method called! | ||
Static method called! | ||
Static method called with args: arg1, arg2, arg3 | ||
Static method called with args: arg1, arg2, arg3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--TEST-- | ||
Indirect call with empty class and/or method name. | ||
--FILE-- | ||
<?php | ||
class TestClass | ||
{ | ||
public static function __callStatic($method, array $args) | ||
{ | ||
var_dump($method); | ||
} | ||
} | ||
|
||
// Test call using array syntax | ||
$callback = ['TestClass', '']; | ||
$callback(); | ||
|
||
// Test call using Class::method syntax. | ||
$callback = 'TestClass::'; | ||
$callback(); | ||
|
||
// Test array syntax with empty class name | ||
$callback = ['', 'method']; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
// Test Class::method syntax with empty class name | ||
$callback = '::method'; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
// Test array syntax with empty class and method name | ||
$callback = ['', '']; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
// Test Class::method syntax with empty class and method name | ||
$callback = '::'; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
// Test string ending in single colon | ||
$callback = 'Class:'; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
// Test string beginning in single colon | ||
$callback = ':method'; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
// Test single colon | ||
$callback = ':'; | ||
try { | ||
$callback(); | ||
} catch (Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
string(0) "" | ||
string(0) "" | ||
Class '' not found | ||
Class '' not found | ||
Class '' not found | ||
Class '' not found | ||
Call to undefined function Class:() | ||
Call to undefined function :method() | ||
Call to undefined function :() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.