Skip to content

Commit

Permalink
Fix local EvalRunner when used in PHAR build
Browse files Browse the repository at this point in the history
The content of `templates/pogolib.php` should remain in the global namespace.
  • Loading branch information
totten committed Dec 21, 2019
1 parent c6df9c2 commit b873362
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions scoper.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php declare(strict_types = 1);

return [
'prefix' => 'PogoPhar',
'files-whitelist' => ['templates/pogolib.php'],
];
3 changes: 2 additions & 1 deletion src/Runner/EvalRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b873362

Please sign in to comment.