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::setStub()/stopBuffering() zip-based --EXTENSIONS-- phar --INI-- phar.requir..

Decoded Output download

--TEST--
Phar::setStub()/stopBuffering() zip-based
--EXTENSIONS--
phar
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$p = new Phar(__DIR__ . '/phar_commitwrite.phar.zip', 0, 'phar_commitwrite.phar');
$p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
spl_autoload_register(function(\$class) {
    include 'phar://' . str_replace('_', '/', \$class);
});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
?>");
var_dump($p->getStub());
var_dump($p->isFileFormat(Phar::ZIP));
?>
--CLEAN--
<?php
unlink(__DIR__ . '/phar_commitwrite.phar.zip');
?>
--EXPECTF--
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
string(%d) "<?php
spl_autoload_register(function($class) {
    include 'phar://' . str_replace('_', '/', $class);
});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
"
bool(true)

Did this file decode correctly?

Original Code

--TEST--
Phar::setStub()/stopBuffering() zip-based
--EXTENSIONS--
phar
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$p = new Phar(__DIR__ . '/phar_commitwrite.phar.zip', 0, 'phar_commitwrite.phar');
$p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
spl_autoload_register(function(\$class) {
    include 'phar://' . str_replace('_', '/', \$class);
});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
?>");
var_dump($p->getStub());
var_dump($p->isFileFormat(Phar::ZIP));
?>
--CLEAN--
<?php
unlink(__DIR__ . '/phar_commitwrite.phar.zip');
?>
--EXPECTF--
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
string(%d) "<?php
spl_autoload_register(function($class) {
    include 'phar://' . str_replace('_', '/', $class);
});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
"
bool(true)

Function Calls

None

Variables

None

Stats

MD5 0fe2ffeb3980958ee1ccea9729daad40
Eval Count 0
Decode Time 96 ms