projects
/
civicrm-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e203563
)
Fix possible upgrade failures when writing to db fields which may not yet exist
author
Coleman Watts
<coleman@civicrm.org>
Sat, 6 Nov 2021 21:47:43 +0000
(17:47 -0400)
committer
Coleman Watts
<coleman@civicrm.org>
Sat, 6 Nov 2021 21:47:43 +0000
(17:47 -0400)
Fixes dev/core#2550
CRM/Core/DAO.php
patch
|
blob
|
blame
|
history
diff --git
a/CRM/Core/DAO.php
b/CRM/Core/DAO.php
index 2a375fbca14d621081e35ac2f5f895258d39d1c7..f6ee6f1c84d080e0bab536adbef98576d839e496 100644
(file)
--- a/
CRM/Core/DAO.php
+++ b/
CRM/Core/DAO.php
@@
-918,7
+918,9
@@
class CRM_Core_DAO extends DB_DataObject {
\CRM_Utils_Hook::pre($hook, $entityName, $record['id'] ?? NULL, $record);
$instance = new $className();
- $instance->copyValues($record);
+ // Ensure fields exist before attempting to write to them
+ $values = array_intersect_key($record, self::getSupportedFields());
+ $instance->copyValues($values);
$instance->save();
\CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance);