From b87336257eb1df3d512a14e7b9edb50b79134921 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 20 Dec 2019 19:08:20 -0800 Subject: [PATCH] Fix local EvalRunner when used in PHAR build The content of `templates/pogolib.php` should remain in the global namespace. --- scoper.inc.php | 6 ++++++ src/Runner/EvalRunner.php | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 scoper.inc.php diff --git a/scoper.inc.php b/scoper.inc.php new file mode 100644 index 0000000..d38c403 --- /dev/null +++ b/scoper.inc.php @@ -0,0 +1,6 @@ + 'PogoPhar', + 'files-whitelist' => ['templates/pogolib.php'], +]; diff --git a/src/Runner/EvalRunner.php b/src/Runner/EvalRunner.php index 4d4ed43..2d39c1c 100644 --- a/src/Runner/EvalRunner.php +++ b/src/Runner/EvalRunner.php @@ -32,7 +32,8 @@ public function run($autoloader, $scriptMetadata, $cliArgs) { global $argv; $oldArgv = $argv; $argv = $_SERVER['argv'] = array_merge([$scriptMetadata->file], $cliArgs); - $code = "?" . ">" . \pogo_script(); + // call_user_func() - Bypass php-scoper + $code = "?" . ">" . call_user_func('\pogo_script'); eval($code); $argv = $_SERVER['argv'] = $oldArgv;