[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_27]: Replaced &$this with $this
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/374090 ) Change subject: Replaced &$this with $this .. Replaced &$this with $this Replaced &$this in includes/Title.php to avoid error in PHP 7.1 Bug: T153505 Change-Id: I76eaae609a817af42687d87bcf0d13da7ba01c05 (cherry picked from commit 529d946e694eb020f137efa31907e28088e2e40d) --- M includes/Title.php 1 file changed, 25 insertions(+), 11 deletions(-) Approvals: Reedy: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Title.php b/includes/Title.php index 4228f93..33b7f03 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1676,8 +1676,9 @@ # Finally, add the fragment. $url .= $this->getFragmentForURL(); - - Hooks::run( 'GetFullURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetFullURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -1750,7 +1751,9 @@ $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); if ( $query == '' ) { $url = str_replace( '$1', $dbkey, $wgArticlePath ); - Hooks::run( 'GetLocalURL::Article', [ &$this, &$url ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetLocalURL::Article', [ &$titleRef, &$url ] ); } else { global $wgVariantArticlePath, $wgActionPaths, $wgContLang; $url = false; @@ -1794,8 +1797,9 @@ $url = "{$wgScript}?title={$dbkey}&{$query}"; } } - - Hooks::run( 'GetLocalURL::Internal', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetLocalURL::Internal', [ &$titleRef, &$url, $query ] ); // @todo FIXME: This causes breakage in various places when we // actually expected a local URL and end up with dupe prefixes. @@ -1803,7 +1807,9 @@ $url = $wgServer . $url; } } - Hooks::run( 'GetLocalURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetLocalURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -1851,7 +1857,9 @@ $query = self::fixUrlQueryArgs( $query, $query2 ); $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; $url = wfExpandUrl( $server . $this->getLocalURL( $query ), PROTO_HTTP ); - Hooks::run( 'GetInternalURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetInternalURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -1869,7 +1877,9 @@ public function getCanonicalURL( $query = '', $query2 = false ) { $query = self::fixUrlQueryArgs( $query, $query2 ); $url = wfExpandUrl( $this->getLocalURL( $query ) . $this->getFragmentForURL(), PROTO_CANONICAL ); - Hooks::run( 'GetCanonicalURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetCanonicalURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -2073,18 +2083,22 @@ private function checkPermissionHooks( $action, $user, $errors, $rigor, $short ) { // Use getUserPermissionsErrors instead $result = ''; - if ( !Hooks::run( 'userCan', [ &$this, &$user, $action, &$result ] ) ) { + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + if ( !Hooks::run( 'userCan', [ &$titleRef, &$user, $action, &$result ] ) ) { return $result ? [] : [ [ 'badaccess-group0' ] ]; } // Check getUserPermissionsErrors hook - if ( !Hooks::run( 'getUserPermissionsErrors', [ &$this, &$user, $action, &$result ] ) ) { + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + if ( !Hooks::run( 'getU
[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_27]: Replaced &$this with $this
Reedy has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374090 ) Change subject: Replaced &$this with $this .. Replaced &$this with $this Replaced &$this in includes/Title.php to avoid error in PHP 7.1 Bug: T153505 Change-Id: I76eaae609a817af42687d87bcf0d13da7ba01c05 (cherry picked from commit 529d946e694eb020f137efa31907e28088e2e40d) --- M includes/Title.php 1 file changed, 25 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/374090/1 diff --git a/includes/Title.php b/includes/Title.php index 4228f93..33b7f03 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1676,8 +1676,9 @@ # Finally, add the fragment. $url .= $this->getFragmentForURL(); - - Hooks::run( 'GetFullURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetFullURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -1750,7 +1751,9 @@ $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); if ( $query == '' ) { $url = str_replace( '$1', $dbkey, $wgArticlePath ); - Hooks::run( 'GetLocalURL::Article', [ &$this, &$url ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetLocalURL::Article', [ &$titleRef, &$url ] ); } else { global $wgVariantArticlePath, $wgActionPaths, $wgContLang; $url = false; @@ -1794,8 +1797,9 @@ $url = "{$wgScript}?title={$dbkey}&{$query}"; } } - - Hooks::run( 'GetLocalURL::Internal', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetLocalURL::Internal', [ &$titleRef, &$url, $query ] ); // @todo FIXME: This causes breakage in various places when we // actually expected a local URL and end up with dupe prefixes. @@ -1803,7 +1807,9 @@ $url = $wgServer . $url; } } - Hooks::run( 'GetLocalURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetLocalURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -1851,7 +1857,9 @@ $query = self::fixUrlQueryArgs( $query, $query2 ); $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; $url = wfExpandUrl( $server . $this->getLocalURL( $query ), PROTO_HTTP ); - Hooks::run( 'GetInternalURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetInternalURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -1869,7 +1877,9 @@ public function getCanonicalURL( $query = '', $query2 = false ) { $query = self::fixUrlQueryArgs( $query, $query2 ); $url = wfExpandUrl( $this->getLocalURL( $query ) . $this->getFragmentForURL(), PROTO_CANONICAL ); - Hooks::run( 'GetCanonicalURL', [ &$this, &$url, $query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + Hooks::run( 'GetCanonicalURL', [ &$titleRef, &$url, $query ] ); return $url; } @@ -2073,18 +2083,22 @@ private function checkPermissionHooks( $action, $user, $errors, $rigor, $short ) { // Use getUserPermissionsErrors instead $result = ''; - if ( !Hooks::run( 'userCan', [ &$this, &$user, $action, &$result ] ) ) { + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + if ( !Hooks::run( 'userCan', [ &$titleRef, &$user, $action, &$result ] ) ) { return $result ? [] : [ [ 'badaccess-group0' ] ]; } // Check getUserPermissionsErrors hook - if ( !Hooks::run( 'getUserPermissionsErrors', [ &$this, &$user, $action, &$result ] ) ) { + // Avoid PHP 7.1 warning from passing $this by reference + $titleRef = $this; + if ( !Hooks::run( 'getUs