BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/206002

Change subject: mergeMessageFileList: Don't rely on the return value of include
......................................................................

mergeMessageFileList: Don't rely on the return value of include

PHP's built-in `include` and `include_once` statements have interesting
semantics. The value returned by the statement is a boolean false (along
with a warning log event) if the include fails, but if it doesn't fail
then the return value is either: (a) all text echo()'d by the file; (b)
any explicit `return` value from the file; (c) a truthy value.

Rather than rely on all extension and skin entry points being nice and
making sure they return truthy values, just `require` the entry point
files instead. If the file can't be read PHP will raise a fatal
E_COMPILE_ERROR signal and log something like "Fatal error: require():
Failed opening required 'not_found.php'"

Change-Id: I6268a77af323b60e8fa4fc4fffe3919af624632f
---
M maintenance/mergeMessageFileList.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/206002/1

diff --git a/maintenance/mergeMessageFileList.php 
b/maintenance/mergeMessageFileList.php
index 43fa460..00e1eb2 100644
--- a/maintenance/mergeMessageFileList.php
+++ b/maintenance/mergeMessageFileList.php
@@ -173,10 +173,10 @@
        // Using extension.json or skin.json
        if ( substr( $fileName, -strlen( '.json' ) ) === '.json' ) {
                $queue[$fileName] = 1;
-       } elseif ( !( include_once $fileName ) ) {
+       } else {
                // Include the extension to update $wgExtensionMessagesFiles
-               fwrite( STDERR, "Unable to read $fileName\n" );
-               exit( 1 );
+               // Will fatal with E_COMPILE_ERROR if the file is not readable
+               require $fileName;
        }
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6268a77af323b60e8fa4fc4fffe3919af624632f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to