summaryrefslogtreecommitdiff
path: root/sapi/cli/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-08-10 10:38:33 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-08-10 10:38:33 +0200
commit896dad4c794f7826812bcfdbaaa9f0b3518d9385 (patch)
tree6ccdc3ec130c5857463878992ee74ef2014fb046 /sapi/cli/tests
parent74c43818066585a5155c6c07b46b3d1727fd14b8 (diff)
downloadphp-git-896dad4c794f7826812bcfdbaaa9f0b3518d9385.tar.gz
Fixed bug #77561
Unconditionally strip shebang lines when using the CLI SAPI, independently of whether they occur in the primary or non-primary script. It's unlikely that someone intentionally wants to print that shebang line when including a script, and this regularly causes issues when scripts are used in multiple contexts, e.g. for direct invocation and as a phar bootstrap.
Diffstat (limited to 'sapi/cli/tests')
-rw-r--r--sapi/cli/tests/bug77561.inc4
-rw-r--r--sapi/cli/tests/bug77561.phpt10
2 files changed, 14 insertions, 0 deletions
diff --git a/sapi/cli/tests/bug77561.inc b/sapi/cli/tests/bug77561.inc
new file mode 100644
index 0000000000..e0ae5b2d13
--- /dev/null
+++ b/sapi/cli/tests/bug77561.inc
@@ -0,0 +1,4 @@
+#!/usr/bin/env php
+<?php
+declare(strict_types=1);
+echo "Test\n";
diff --git a/sapi/cli/tests/bug77561.phpt b/sapi/cli/tests/bug77561.phpt
new file mode 100644
index 0000000000..42ce9b53db
--- /dev/null
+++ b/sapi/cli/tests/bug77561.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #77561: Shebang line not stripped for non-primary script
+--FILE--
+<?php
+
+require __DIR__ . '/bug77561.inc';
+
+?>
+--EXPECT--
+Test