From 93c614c184d30ae9cc199c7f020e4651392c2d7b Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 11 Jan 2016 19:52:33 +0100 Subject: [PATCH] Do updateWithKeys properly if someone would like to update PRI --- classes/Managed_DataObject.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Managed_DataObject.php b/classes/Managed_DataObject.php index 7492d90978..68de8922ce 100644 --- a/classes/Managed_DataObject.php +++ b/classes/Managed_DataObject.php @@ -420,7 +420,7 @@ abstract class Managed_DataObject extends Memcached_DataObject * @param DB_DataObject &$orig Must be "instanceof" $this * @param string $pid Primary ID column (no escaping is done on column name!) */ - public function updateWithKeys(&$orig, $pid='id') + public function updateWithKeys(Managed_DataObject $orig, $pid='id') { if (!$orig instanceof $this) { throw new ServerException('Tried updating a DataObject with a different class than itself.'); @@ -456,7 +456,7 @@ abstract class Managed_DataObject extends Memcached_DataObject common_database_tablename($this->tableName()), implode(', ', $parts), $pid, - $this->_quote($this->$pid)); + $this->_quote($orig->$pid)); $result = $this->query($qry); if ($result === false) { -- 2.39.5