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-- Test command that exist --SKIPIF-- <?php if (!extension_loaded("pcntl")) die("Ski..
Decoded Output download
--TEST--
Test command that exist
--SKIPIF--
<?php if (!extension_loaded("pcntl")) die("Skipped: pcntl extension required."); ?>
--FILE--
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\SignalableCommandInterface;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = \dirname($vendor);
}
require $vendor.'/vendor/autoload.php';
class MyCommand extends Command implements SignalableCommandInterface
{
protected function execute(InputInterface $input, OutputInterface $output): int
{
posix_kill(posix_getpid(), \SIGINT);
$output->writeln('should not be displayed');
return 0;
}
public function getSubscribedSignals(): array
{
return [\SIGINT];
}
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false
{
echo "Received signal!";
return 0;
}
}
$app = new Application();
$app->setDispatcher(new \Symfony\Component\EventDispatcher\EventDispatcher());
$app->add(new MyCommand('foo'));
$app
->setDefaultCommand('foo', true)
->run()
;
--EXPECT--
Received signal!
?>
Did this file decode correctly?
Original Code
--TEST--
Test command that exist
--SKIPIF--
<?php if (!extension_loaded("pcntl")) die("Skipped: pcntl extension required."); ?>
--FILE--
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\SignalableCommandInterface;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = \dirname($vendor);
}
require $vendor.'/vendor/autoload.php';
class MyCommand extends Command implements SignalableCommandInterface
{
protected function execute(InputInterface $input, OutputInterface $output): int
{
posix_kill(posix_getpid(), \SIGINT);
$output->writeln('should not be displayed');
return 0;
}
public function getSubscribedSignals(): array
{
return [\SIGINT];
}
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false
{
echo "Received signal!";
return 0;
}
}
$app = new Application();
$app->setDispatcher(new \Symfony\Component\EventDispatcher\EventDispatcher());
$app->add(new MyCommand('foo'));
$app
->setDefaultCommand('foo', true)
->run()
;
--EXPECT--
Received signal!
Function Calls
None |
Stats
MD5 | 52ae85d8006a8c4433107cc31554bc82 |
Eval Count | 0 |
Decode Time | 84 ms |