Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Phar: rename test zip-based --EXTENSIONS-- phar --INI-- phar.readonly=0 phar.requ..

Decoded Output download

--TEST--
Phar: rename test zip-based
--EXTENSIONS--
phar
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php

$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
$alias = 'phar://' . $fname;

$phar = new Phar($fname);
$phar->setStub("<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>");
$phar['a'] = 'a';
$phar->stopBuffering();

include $fname;

echo file_get_contents($alias . '/a') . "
";
rename($alias . '/a', $alias . '/b');
echo file_get_contents($alias . '/b') . "
";
echo file_get_contents($alias . '/a') . "
";
?>
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
a
a

Warning: file_get_contents(phar://%srename.phar.zip/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.zip" in %srename.php on line %d

Did this file decode correctly?

Original Code

--TEST--
Phar: rename test zip-based
--EXTENSIONS--
phar
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php

$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
$alias = 'phar://' . $fname;

$phar = new Phar($fname);
$phar->setStub("<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>");
$phar['a'] = 'a';
$phar->stopBuffering();

include $fname;

echo file_get_contents($alias . '/a') . "\n";
rename($alias . '/a', $alias . '/b');
echo file_get_contents($alias . '/b') . "\n";
echo file_get_contents($alias . '/a') . "\n";
?>
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
a
a

Warning: file_get_contents(phar://%srename.phar.zip/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.zip" in %srename.php on line %d

Function Calls

None

Variables

None

Stats

MD5 aaef1d362c7b157aff7382c6f0256d4c
Eval Count 0
Decode Time 98 ms