Пример #1
0
    public function testIfWillAllowUcFirst()
    {
        $code = <<<'CODE'
<?php
ucfirst('fooo');
CODE;
        $r = Whitelist::fly()->check($code);
        $this->assertTrue($r);
    }
Пример #2
0
 public function testIfWillFailSanitization()
 {
     $code = file_get_contents(__DIR__ . '/layout.php');
     // For dev help
     $t = new Tokenizer($code);
     $tokens = $t->getTokens();
     $funcs = $t->getFunctions();
     // Actual test
     $r = Whitelist::fly()->check($code);
     $this->assertFalse($r);
 }
Пример #3
0
    public function testIfWillForbidEvaluativeExpressions()
    {
        $code = <<<'CODE'
<?php
eval();
assert();
preg_replace('/.*/e','');
create_function();
include();
include_once();
require();
require_once();
$_GET['func_name']($_GET['argument']);
$func = new ReflectionFunction($_GET['func_name']); $func->invoke(); or $func->invokeArgs(array());
CODE;
        Whitelist::fly()->check($code);
    }