MDL-71086 core: load only those properties defined within persistent.

This commit is contained in:
Paul Holden
2021-10-11 09:09:27 +01:00
parent e746dc75af
commit de2b0565a7
3 changed files with 19 additions and 2 deletions
+2 -1
View File
@@ -403,7 +403,8 @@ abstract class persistent {
* @return static
*/
final public function from_record(stdClass $record) {
$record = (array) $record;
$properties = static::properties_definition();
$record = array_intersect_key((array) $record, $properties);
foreach ($record as $property => $value) {
$this->raw_set($property, $value);
}