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 gzipped tar --EXTENSIONS-- phar zlib --INI-- phar...

Decoded Output download

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

$fname = __DIR__ . '/tar_makegz.phar.tar';
$fname2 = __DIR__ . '/tar_makegz.phar.tar.gz';
$fname3 = __DIR__ . '/tar_makegz_b.phar.tar.gz';

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


copy($fname2, $fname3);

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

?>
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_makegz.phar.gz');
@unlink(__DIR__ . '/tar_makegz.phar.tar');
@unlink(__DIR__ . '/tar_makegz.phar.tar.gz');
@unlink(__DIR__ . '/tar_makegz_b.phar.tar.gz');
?>
--EXPECT--
bool(true)
bool(true)
bool(true)

Did this file decode correctly?

Original Code

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

$fname = __DIR__ . '/tar_makegz.phar.tar';
$fname2 = __DIR__ . '/tar_makegz.phar.tar.gz';
$fname3 = __DIR__ . '/tar_makegz_b.phar.tar.gz';

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


copy($fname2, $fname3);

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

?>
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_makegz.phar.gz');
@unlink(__DIR__ . '/tar_makegz.phar.tar');
@unlink(__DIR__ . '/tar_makegz.phar.tar.gz');
@unlink(__DIR__ . '/tar_makegz_b.phar.tar.gz');
?>
--EXPECT--
bool(true)
bool(true)
bool(true)

Function Calls

None

Variables

None

Stats

MD5 003540e1543847049f10bb374958dd0e
Eval Count 0
Decode Time 95 ms