Add workaround for HHVM issue 6206

Just use the actual global on HHVM, like we do on
Zend, but avoid hitting the warning.

This is a workaround for https://github.com/facebook/hhvm/issues/6206

Bug: T111641
Change-Id: I15ef0e90827c94a8b2609484b0dddcb78f04284c
This commit is contained in:
Marius Hoch 2017-05-19 20:50:58 +02:00 committed by Krinkle
parent 657aa49b87
commit c2c7452577

View file

@ -1,5 +1,6 @@
<?php
use Closure;
use MediaWiki\Logger\LegacySpi;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\Logger\MonologSpi;
@ -737,6 +738,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
$GLOBALS[$globalKey] instanceof FauxRequest
) {
$this->mwGlobals[$globalKey] = clone $GLOBALS[$globalKey];
} elseif ( $GLOBALS[$globalKey] instanceof Closure ) {
// Serializing Closure only gives a warning on HHVM while
// it throws an Exception on Zend.
// Workaround for https://github.com/facebook/hhvm/issues/6206
$this->mwGlobals[$globalKey] = $GLOBALS[$globalKey];
} else {
try {
$this->mwGlobals[$globalKey] = unserialize( serialize( $GLOBALS[$globalKey] ) );