Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.116.62.169
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
3 /
nikic /
php-parser /
test /
PhpParser /
Delete
Unzip
Name
Size
Permission
Date
Action
Builder
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
ErrorHandler
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
Internal
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
Lexer
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
Node
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
NodeVisitor
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
Parser
[ DIR ]
drwxr-xr-x
2018-10-10 09:00
BuilderFactoryTest.php
11.11
KB
-rw-r--r--
2018-10-10 09:00
CodeParsingTest.php
4
KB
-rw-r--r--
2018-10-10 09:00
CodeTestAbstract.php
1021
B
-rw-r--r--
2018-10-10 09:00
CodeTestParser.php
1.89
KB
-rw-r--r--
2018-10-10 09:00
CommentTest.php
1.76
KB
-rw-r--r--
2018-10-10 09:00
ConstExprEvaluatorTest.php
4.06
KB
-rw-r--r--
2018-10-10 09:00
ErrorTest.php
3.53
KB
-rw-r--r--
2018-10-10 09:00
JsonDecoderTest.php
1.28
KB
-rw-r--r--
2018-10-10 09:00
LexerTest.php
9.18
KB
-rw-r--r--
2018-10-10 09:00
NameContextTest.php
3.06
KB
-rw-r--r--
2018-10-10 09:00
NodeAbstractTest.php
9.84
KB
-rw-r--r--
2018-10-10 09:00
NodeDumperTest.php
2.41
KB
-rw-r--r--
2018-10-10 09:00
NodeFinderTest.php
2.32
KB
-rw-r--r--
2018-10-10 09:00
NodeTraverserTest.php
15.23
KB
-rw-r--r--
2018-10-10 09:00
ParserFactoryTest.php
1.06
KB
-rw-r--r--
2018-10-10 09:00
ParserTest.php
7.46
KB
-rw-r--r--
2018-10-10 09:00
PrettyPrinterTest.php
12.14
KB
-rw-r--r--
2018-10-10 09:00
Save
Rename
<?php declare(strict_types=1); namespace PhpParser; use PhpParser\Node\Expr; use PhpParser\Node\Scalar; use PHPUnit\Framework\TestCase; class ConstExprEvaluatorTest extends TestCase { /** @dataProvider provideTestEvaluate */ public function testEvaluate($exprString, $expected) { $parser = new Parser\Php7(new Lexer()); $expr = $parser->parse('<?php ' . $exprString . ';')[0]->expr; $evaluator = new ConstExprEvaluator(); $this->assertSame($expected, $evaluator->evaluateDirectly($expr)); } public function provideTestEvaluate() { return [ ['1', 1], ['1.0', 1.0], ['"foo"', "foo"], ['[0, 1]', [0, 1]], ['["foo" => "bar"]', ["foo" => "bar"]], ['NULL', null], ['False', false], ['true', true], ['+1', 1], ['-1', -1], ['~0', -1], ['!true', false], ['[0][0]', 0], ['"a"[0]', "a"], ['true ? 1 : (1/0)', 1], ['false ? (1/0) : 1', 1], ['42 ?: (1/0)', 42], ['false ?: 42', 42], ['false ?? 42', false], ['null ?? 42', 42], ['[0][0] ?? 42', 0], ['[][0] ?? 42', 42], ['0b11 & 0b10', 0b10], ['0b11 | 0b10', 0b11], ['0b11 ^ 0b10', 0b01], ['1 << 2', 4], ['4 >> 2', 1], ['"a" . "b"', "ab"], ['4 + 2', 6], ['4 - 2', 2], ['4 * 2', 8], ['4 / 2', 2], ['4 % 2', 0], ['4 ** 2', 16], ['1 == 1.0', true], ['1 != 1.0', false], ['1 < 2.0', true], ['1 <= 2.0', true], ['1 > 2.0', false], ['1 >= 2.0', false], ['1 <=> 2.0', -1], ['1 === 1.0', false], ['1 !== 1.0', true], ['true && true', true], ['true and true', true], ['false && (1/0)', false], ['false and (1/0)', false], ['false || false', false], ['false or false', false], ['true || (1/0)', true], ['true or (1/0)', true], ['true xor false', true], ]; } public function testEvaluateFails() { $this->expectException(ConstExprEvaluationException::class); $this->expectExceptionMessage('Expression of type Expr_Variable cannot be evaluated'); $evaluator = new ConstExprEvaluator(); $evaluator->evaluateDirectly(new Expr\Variable('a')); } public function testEvaluateFallback() { $evaluator = new ConstExprEvaluator(function(Expr $expr) { if ($expr instanceof Scalar\MagicConst\Line) { return 42; } throw new ConstExprEvaluationException(); }); $expr = new Expr\BinaryOp\Plus( new Scalar\LNumber(8), new Scalar\MagicConst\Line() ); $this->assertSame(50, $evaluator->evaluateDirectly($expr)); } /** * @dataProvider provideTestEvaluateSilently */ public function testEvaluateSilently($expr, $exception, $msg) { $evaluator = new ConstExprEvaluator(); try { $evaluator->evaluateSilently($expr); } catch (ConstExprEvaluationException $e) { $this->assertSame( 'An error occurred during constant expression evaluation', $e->getMessage() ); $prev = $e->getPrevious(); $this->assertInstanceOf($exception, $prev); $this->assertSame($msg, $prev->getMessage()); } } public function provideTestEvaluateSilently() { return [ [ new Expr\BinaryOp\Mod(new Scalar\LNumber(42), new Scalar\LNumber(0)), \Error::class, 'Modulo by zero' ], [ new Expr\BinaryOp\Div(new Scalar\LNumber(42), new Scalar\LNumber(0)), \ErrorException::class, 'Division by zero' ], ]; } }