Skip to content

Commit

Permalink
MDL-70877 php: remove final functions __clone and __wakeup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marinaglancy authored and stronk7 committed Feb 26, 2021
1 parent 95dd305 commit a7553de
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
6 changes: 0 additions & 6 deletions lib/externallib.php
Expand Up @@ -1232,12 +1232,6 @@ protected function __construct() {
}
}

/**
* Clone - private - can not be cloned
*/
private final function __clone() {
}

/**
* Return only one instance
*
Expand Down
14 changes: 0 additions & 14 deletions lib/filestorage/file_system.php
Expand Up @@ -34,20 +34,6 @@
*/
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.
*
Expand Down

0 comments on commit a7553de

Please sign in to comment.