From a7553de7ad4225631a0590884ddf69e678539c08 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Wed, 17 Feb 2021 14:31:43 +0100 Subject: [PATCH] MDL-70877 php: remove final functions __clone and __wakeup Implementing these functions as final does not prevent the object to be cloned or serialized, so the comment to them was wrong. However having these functions not public breaks in PHP 8.0. It still does not make sense to clone or serialise file_system or external_settings classes but there are a lot of classes in moodle that should not be cloned, no reason to have a specific solution here. --- lib/externallib.php | 6 ------ lib/filestorage/file_system.php | 14 -------------- 2 files changed, 20 deletions(-) diff --git a/lib/externallib.php b/lib/externallib.php index 17b4a297cbe..da78def4ec6 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -1232,12 +1232,6 @@ class external_settings { } } - /** - * Clone - private - can not be cloned - */ - private final function __clone() { - } - /** * Return only one instance * diff --git a/lib/filestorage/file_system.php b/lib/filestorage/file_system.php index e8a78fb8160..2339c13bd80 100644 --- a/lib/filestorage/file_system.php +++ b/lib/filestorage/file_system.php @@ -34,20 +34,6 @@ defined('MOODLE_INTERNAL') || die(); */ abstract class file_system { - /** - * Private clone method to prevent cloning of the instance. - */ - final protected function __clone() { - return; - } - - /** - * Private wakeup method to prevent unserialising of the instance. - */ - final protected function __wakeup() { - return; - } - /** * Output the content of the specified stored file. *