Fix #562: Prevent direct execution of test server script unless testing

This commit is contained in:
Zach Borboa
2019-01-05 12:09:03 -08:00
parent 4551e28ddd
commit 7dd4258e02
3 changed files with 8 additions and 0 deletions
+2
View File
@@ -1,4 +1,6 @@
<?php
// Prevent direct access unless testing.
getenv('PHP_CURL_CLASS_TEST_MODE_ENABLED') === 'yes' || exit;
require_once 'ContentRangeServer.php';
require_once 'RangeHeader.php';
+3
View File
@@ -40,6 +40,9 @@ else
fastcgi_pass="127.0.0.1:9000"
fi
# Let test server know we should allow testing.
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
if [[ "${TRAVIS_PHP_VERSION}" == "5.3" ]]; then
if ! [ -x "$(command -v add-apt-repository)" ]; then
$superuser apt-get install -y python-software-properties
+3
View File
@@ -3,6 +3,9 @@ cd "${SCRIPT_DIR}"
set -x
# Let test server know we should allow testing.
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
php -S 127.0.0.1:8000 -t PHPCurlClass/ &> /dev/null &
pid="${!}"
extra_args="${@}"