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: tar-based phar, make new bzipped tar --EXTENSIONS-- phar bz2 --INI-- phar.r..

Decoded Output download

--TEST--
Phar: tar-based phar, make new bzipped tar
--EXTENSIONS--
phar
bz2
--INI--
phar.readonly=0
--FILE--
<?php

$fname = __DIR__ . '/tar_makebz2.phar.tar';
$fname2 = __DIR__ . '/tar_makebz2.phar.tar.bz2';
$fname3 = __DIR__ . '/tar_makebz2_b.phar.tar.bz2';

$phar = new Phar($fname);
$phar['test'] = 'hi';
var_dump($phar->isFileFormat(Phar::TAR));
$phar = $phar->compress(Phar::BZ2);

copy($fname2, $fname3);

$phar2 = new Phar($fname3);
var_dump($phar2->isFileFormat(Phar::TAR));
var_dump($phar2->isCompressed() == Phar::BZ2);

?>
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_makebz2.phar.bz2');
@unlink(__DIR__ . '/tar_makebz2.phar.tar');
@unlink(__DIR__ . '/tar_makebz2.phar.tar.bz2');
@unlink(__DIR__ . '/tar_makebz2_b.phar.tar.bz2');
?>
--EXPECT--
bool(true)
bool(true)
bool(true)

Did this file decode correctly?

Original Code

--TEST--
Phar: tar-based phar, make new bzipped tar
--EXTENSIONS--
phar
bz2
--INI--
phar.readonly=0
--FILE--
<?php

$fname = __DIR__ . '/tar_makebz2.phar.tar';
$fname2 = __DIR__ . '/tar_makebz2.phar.tar.bz2';
$fname3 = __DIR__ . '/tar_makebz2_b.phar.tar.bz2';

$phar = new Phar($fname);
$phar['test'] = 'hi';
var_dump($phar->isFileFormat(Phar::TAR));
$phar = $phar->compress(Phar::BZ2);

copy($fname2, $fname3);

$phar2 = new Phar($fname3);
var_dump($phar2->isFileFormat(Phar::TAR));
var_dump($phar2->isCompressed() == Phar::BZ2);

?>
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_makebz2.phar.bz2');
@unlink(__DIR__ . '/tar_makebz2.phar.tar');
@unlink(__DIR__ . '/tar_makebz2.phar.tar.bz2');
@unlink(__DIR__ . '/tar_makebz2_b.phar.tar.bz2');
?>
--EXPECT--
bool(true)
bool(true)
bool(true)

Function Calls

None

Variables

None

Stats

MD5 3761d11faaf67ded1139fcf21196c5ac
Eval Count 0
Decode Time 108 ms