AssetManager\Resolver\PathStackResolver::setLfiProtection PHP Method

setLfiProtection() public method

Set LFI protection flag
public setLfiProtection ( boolean $flag ) : self
$flag boolean
return self
    public function setLfiProtection($flag)
    {
        $this->lfiProtectionOn = (bool) $flag;
    }

Usage Example

コード例 #1
0
 public function testLfiProtection()
 {
     $mimeResolver = new MimeResolver();
     $resolver = new PathStackResolver();
     $resolver->setMimeResolver($mimeResolver);
     // should be on by default
     $this->assertTrue($resolver->isLfiProtectionOn());
     $resolver->addPath(__DIR__);
     $this->assertNull($resolver->resolve('..' . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__)));
     $resolver->setLfiProtection(false);
     $this->assertEquals(file_get_contents(__FILE__), $resolver->resolve('..' . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__))->dump());
 }