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

This is a backport of the patch from MDL-71086.
This commit is contained in:
Paul Holden
2022-03-10 21:40:42 +01:00
committed by Sara Arjona
parent a059ee52a4
commit f29ee3a772
3 changed files with 21 additions and 2 deletions
+2 -1
View File
@@ -393,7 +393,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);
}