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

Signing you up...

Thank you for signing up!

PHP Decode

<?php $vendor_path = 'vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/C..

Decoded Output download

<?php

$vendor_path = 'vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/ClassAliasStmtAppender.php';

if (!file_exists($vendor_path)) {
    die('Vendor file does not exist' . PHP_EOL);
}

$search = '/* @var FullyQualified $originalName */

        $stmts[] = $this->createAliasStmt($originalName, $stmt);';

$replace = '/* @var FullyQualified $originalName */
        $aliasStmt = $this->createAliasStmt($originalName, $stmt);

        $stmts[] = new Node\Stmt\If_(
            new Node\Expr\BooleanNot(
                new Node\Expr\FuncCall(
                    new FullyQualified(\'class_exists\'),
                    [
                        new Node\Arg(
                            new Node\Expr\ClassConstFetch(
                                $originalName,
                                \'class\'
                            )
                        ),
                        new Node\Arg(
                            new Node\Expr\ConstFetch(
                                new Node\Name(\'false\')
                            )
                        )
                    ]
                )
            ),
            [\'stmts\' => [$aliasStmt]]
        );';

$contents = file_get_contents($vendor_path);

$contents = str_replace($search, $replace, $contents);

file_put_contents($vendor_path, $contents);
 ?>

Did this file decode correctly?

Original Code

<?php

$vendor_path = 'vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/ClassAliasStmtAppender.php';

if (!file_exists($vendor_path)) {
    die('Vendor file does not exist' . PHP_EOL);
}

$search = '/* @var FullyQualified $originalName */

        $stmts[] = $this->createAliasStmt($originalName, $stmt);';

$replace = '/* @var FullyQualified $originalName */
        $aliasStmt = $this->createAliasStmt($originalName, $stmt);

        $stmts[] = new Node\Stmt\If_(
            new Node\Expr\BooleanNot(
                new Node\Expr\FuncCall(
                    new FullyQualified(\'class_exists\'),
                    [
                        new Node\Arg(
                            new Node\Expr\ClassConstFetch(
                                $originalName,
                                \'class\'
                            )
                        ),
                        new Node\Arg(
                            new Node\Expr\ConstFetch(
                                new Node\Name(\'false\')
                            )
                        )
                    ]
                )
            ),
            [\'stmts\' => [$aliasStmt]]
        );';

$contents = file_get_contents($vendor_path);

$contents = str_replace($search, $replace, $contents);

file_put_contents($vendor_path, $contents);

Function Calls

file_exists 1
str_replace 1
file_get_contents 1
file_put_contents 1

Variables

$search /* @var FullyQualified $originalName */ $stmts[] = ..
$replace /* @var FullyQualified $originalName */ $aliasStmt =..
$contents
$vendor_path vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVi..

Stats

MD5 a78b9ba976628df20a8affc85281113d
Eval Count 0
Decode Time 88 ms