jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/396301 )

Change subject: Fix maintenance script failure when run as a child of a FastCGI 
worker
......................................................................


Fix maintenance script failure when run as a child of a FastCGI worker

Use PHP_SAPI==cli instead of checking $_SERVER['REQUEST_METHOD'],
since $_SERVER is populated from the environment when running HHVM in
CLI mode. Environment variables set by a FastCGI worker thus leak
through to child processes run via the shell, and cause this check to
fail.

When I wrote this check in March 2004 (r2803), I didn't know about
PHP_SAPI. Checking PHP_SAPI is quite sufficient to prevent web execution,
we use it in other places.

Bug: T111441
Change-Id: Iad8469ee25df4b0e0c2371e7975a300b1695dd8d
---
M maintenance/Maintenance.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  BryanDavis: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index 255892b..a3e0ffd 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -662,7 +662,7 @@
                global $IP, $wgCommandLineMode, $wgRequestTime;
 
                # Abort if called from a web server
-               if ( isset( $_SERVER ) && isset( $_SERVER['REQUEST_METHOD'] ) ) 
{
+               if ( PHP_SAPI !== 'cli' ) {
                        $this->fatalError( 'This script must be run from the 
command line' );
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/396301
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iad8469ee25df4b0e0c2371e7975a300b1695dd8d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to