r72236 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72235‎ | r72236 | r72237 >
Date:22:08, 2 September 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
$result = '' in Title->checkPermissionHooks

Fixup $session in ApiWatchTest
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/media/GIF.php (modified) (history)
  • /trunk/phase3/maintenance/tests/ApiWatchTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/ApiWatchTest.php
@@ -21,7 +21,7 @@
2222 function doApiRequest( $params, $data = null ) {
2323 $_SESSION = isset( $data[2] ) ? $data[2] : array();
2424
25 - $req = new FauxRequest( $params, true, $session );
 25+ $req = new FauxRequest( $params, true, $_SESSION );
2626 $module = new ApiMain( $req, true );
2727 $module->execute();
2828
Index: trunk/phase3/includes/media/GIF.php
@@ -14,7 +14,7 @@
1515 class GIFHandler extends BitmapHandler {
1616
1717 function getMetadata( $image, $filename ) {
18 - if ( !isset($image->parsedGIFMetadata) ) {
 18+ if ( !isset( $image->parsedGIFMetadata ) ) {
1919 try {
2020 $image->parsedGIFMetadata = GIFMetadataExtractor::getMetadata( $filename );
2121 } catch( Exception $e ) {
@@ -24,7 +24,7 @@
2525 }
2626 }
2727
28 - return serialize($image->parsedGIFMetadata);
 28+ return serialize( $image->parsedGIFMetadata );
2929
3030 }
3131
Index: trunk/phase3/includes/Title.php
@@ -1316,6 +1316,7 @@
13171317 */
13181318 private function checkPermissionHooks( $action, $user, $errors, $doExpensiveQueries, $short ) {
13191319 // Use getUserPermissionsErrors instead
 1320+ $result = '';
13201321 if ( !wfRunHooks( 'userCan', array( &$this, &$user, $action, &$result ) ) ) {
13211322 return $result ? array() : array( array( 'badaccess-group0' ) );
13221323 }

Comments

#Comment by Catrope (talk | contribs)   13:00, 14 December 2010
+		$result = '';

Given the semantics of the userCan hook, wouldn't false be more fitting? (In practice of course, $result is only used in a ternary so it doesn't matter a whole lot.)

Status & tagging log