Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 463b2db

Browse files
[Runtime] dont display the shebang on the CLI
1 parent e03ab57 commit 463b2db

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Symfony/Component/Runtime/Internal/autoload_runtime.template

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FI
66
return;
77
}
88

9-
if (!is_object($app = require $_SERVER['SCRIPT_FILENAME'])) {
10-
throw new \TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
9+
if (PHP_VERSION_ID < 80000 && in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
10+
ob_start();
11+
$app = require $_SERVER['SCRIPT_FILENAME'];
12+
ob_end_clean();
13+
} else {
14+
$app = require $_SERVER['SCRIPT_FILENAME'];
15+
}
16+
17+
if (!is_object($app)) {
18+
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
1119
}
1220

1321
$runtime = $_SERVER['APP_RUNTIME'] ?? %runtime_class%;

0 commit comments

Comments
 (0)