Ensure $user is passed by reference in TitleMoveComplete hook on HHVM
authorKunal Mehta <legoktm@member.fsf.org>
Thu, 7 Jun 2018 19:52:04 +0000 (12:52 -0700)
committerKrinkle <krinklemail@gmail.com>
Fri, 8 Jun 2018 14:45:54 +0000 (14:45 +0000)
Suggested by Anomie in T118683#3688320.

Bug: T118683
Change-Id: I57e05c5ae42c8b85d0a8f9631a459c5686b27893
(cherry picked from commit d5e4bf920c7ff48bf4c907bee1ee47fa96907774)

RELEASE-NOTES-1.31
includes/MovePage.php

index c98f663..6f242fb 100644 (file)
@@ -11,6 +11,7 @@ production.
 * (T196185) Don't allow setting $wgDBmysql5 in the installer.
 * (T196125) php-memcached 3.0 (provided with PHP 7.0) is now supported.
 * (T182366) UploadBase::checkXMLEncodingMissmatch() now works on PHP 7.1+
 * (T196185) Don't allow setting $wgDBmysql5 in the installer.
 * (T196125) php-memcached 3.0 (provided with PHP 7.0) is now supported.
 * (T182366) UploadBase::checkXMLEncodingMissmatch() now works on PHP 7.1+
+* (T118683) Fix exception from &$user deref on HHVM in the TitleMoveComplete hook.
 
 === Changes since MediaWiki 1.31.0-rc.0 ===
 * (T33223) Drop archive.ar_text and ar_flags.
 
 === Changes since MediaWiki 1.31.0-rc.0 ===
 * (T33223) Drop archive.ar_text and ar_flags.
index fc9f6a6..1e9570d 100644 (file)
@@ -415,7 +415,9 @@ class MovePage {
                        new AtomicSectionUpdate(
                                $dbw,
                                __METHOD__,
                        new AtomicSectionUpdate(
                                $dbw,
                                __METHOD__,
-                               function () use ( $params ) {
+                               // Hold onto $user to avoid HHVM bug where it no longer
+                               // becomes a reference (T118683)
+                               function () use ( $params, &$user ) {
                                        Hooks::run( 'TitleMoveComplete', $params );
                                }
                        )
                                        Hooks::run( 'TitleMoveComplete', $params );
                                }
                        )