In the case that something is not serializable then
we should fall back and just set the value.
This is the case for Closures..
See
http://wikidata-jenkins.wmflabs.org/ci/job/wikidata-client-tests/748/console
Change-Id: Ib5f76932d60840a2f97671c134e18adc619974cd
// NOTE: we serialize then unserialize the value in case it is an object
// this stops any objects being passed by reference. We could use clone
// and if is_object but this does account for objects within objects!
- $this->mwGlobals[$key] = unserialize( serialize( $GLOBALS[$key] ) );
+ try{
+ $this->mwGlobals[$key] = unserialize( serialize( $GLOBALS[$key] ) );
+ }
+ // NOTE; some things such as Closures are not serializable
+ // in this case just set the value!
+ catch( Exception $e ) {
+ $this->mwGlobals[$key] = $GLOBALS[$key];
+ }
}
// Override the global