From: nullzero Date: Tue, 31 Dec 2013 06:42:35 +0000 (-0500) Subject: LogEntry: Make newFromRow work with RC object X-Git-Tag: 1.31.0-rc.0~17435^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=5c06f5f51743d3cde185d3c81b1d771e08863b14;p=lhc%2Fweb%2Fwiklou.git LogEntry: Make newFromRow work with RC object LogEntry::newFromRow is supposed to give a RCDatabaseLogEntry if the given row is a RC log entry. The previous code only did this if an array was passed as the $row argument. This adds a type cast and fixes the function so that the proper LogEntry subclass is returned no matter what variable type is passed to the function. Bug: 52053 Change-Id: I6f64358837b37c54d00a7544e9e8a92c216bbe89 --- diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 76c2280cd0..71b4fc24d7 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -161,8 +161,9 @@ class DatabaseLogEntry extends LogEntryBase { * @return DatabaseLogEntry */ public static function newFromRow( $row ) { - if ( is_array( $row ) && isset( $row['rc_logid'] ) ) { - return new RCDatabaseLogEntry( (object)$row ); + $row = (object)$row; + if ( isset( $row->rc_logid ) ) { + return new RCDatabaseLogEntry( $row ); } else { return new self( $row ); }