MDL-79890 core: ReflectionProperties::setValue() should take 2 args

Since PHP 8.3 setValue() must be called with null as the first arg if
called statically.
This commit is contained in:
Andrew Nicols
2023-11-15 09:14:34 +08:00
parent 14414fe253
commit 898ac0ab6d
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -1968,7 +1968,7 @@ class accesslib_test extends advanced_testcase {
$mockedplugins->setAccessible(true);
$plugins = $mockedplugins->getValue();
$plugins['fake'] = [$pluginname => "{$CFG->dirroot}/lib/tests/fixtures/fakeplugins/$pluginname"];
$mockedplugins->setValue($plugins);
$mockedplugins->setValue(null, $plugins);
update_capabilities('fake_access');
$this->resetDebugging(); // We have debugging messages here that we need to get rid of.
// End of the component loader mock.
@@ -52,13 +52,13 @@ trait subplugins_test_helper_trait {
$mockedplugins->setAccessible(true);
$plugins = $mockedplugins->getValue();
$plugins[extension::BBB_EXTENSION_PLUGIN_NAME] = [$pluginname => $bbbextpath . "/$pluginname"];
$mockedplugins->setValue($plugins);
$mockedplugins->setValue(null, $plugins);
$mockedplugintypes = $mockedcomponent->getProperty('plugintypes');
$mockedplugintypes->setAccessible(true);
$pluginstypes = $mockedplugintypes->getValue();
$pluginstypes[extension::BBB_EXTENSION_PLUGIN_NAME] = $bbbextpath;
$mockedplugintypes->setValue($pluginstypes);
$mockedplugintypes->setValue(null, $pluginstypes);
$fillclassmap = $mockedcomponent->getMethod('fill_classmap_cache');
$fillclassmap->setAccessible(true);
@@ -72,7 +72,7 @@ trait subplugins_test_helper_trait {
$mockedsubplugins->setAccessible(true);
$subplugins = $mockedsubplugins->getValue();
$subplugins['mod_bigbluebuttonbn'][extension::BBB_EXTENSION_PLUGIN_NAME][] = $pluginname;
$mockedsubplugins->setValue($subplugins);
$mockedsubplugins->setValue(null, $subplugins);
// Now write the content of the cache in a file so we can use it later.
$content = core_component::get_cache_content();
@@ -149,7 +149,7 @@ trait subplugins_test_helper_trait {
// Here we reset the plugin caches.
$mockedplugintypes = $mockedcomponent->getProperty('plugintypes');
$mockedplugintypes->setAccessible(true);
$mockedplugintypes->setValue(null);
$mockedplugintypes->setValue(null, null);
$fillclassmap = $mockedcomponent->getMethod('init');
$fillclassmap->setAccessible(true);
$fillclassmap->invoke(null);
@@ -263,7 +263,7 @@ XPATH
$mockedcomponent = new ReflectionClass(core_component::class);
$mockedplugintypes = $mockedcomponent->getProperty('plugintypes');
$mockedplugintypes->setAccessible(true);
$mockedplugintypes->setValue(null);
$mockedplugintypes->setValue(null, null);
$init = $mockedcomponent->getMethod('init');
$init->setAccessible(true);
$init->invoke(null);