Correct isset() and associated checks in Revision::__construct()
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 28 Dec 2012 12:03:06 +0000 (13:03 +0100)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 28 Dec 2012 12:03:06 +0000 (13:03 +0100)
isset() checks that the member is set *and* its value is not null,
so there's no point doing a second is_null() check.
This also fixes an E_NOTICE when rev_parent_id is not set since
is_null() was called on it after isset() returned false.

Change-Id: I07bf670236413436d23ee5d87d032608b25769ce

includes/Revision.php

index cc79c64..5f62e4d 100644 (file)
@@ -493,13 +493,13 @@ class Revision implements IDBAccessObject {
                        $this->mTimestamp =         $row->rev_timestamp;
                        $this->mDeleted   = intval( $row->rev_deleted );
 
-                       if( !isset( $row->rev_parent_id ) ) {
-                               $this->mParentId = is_null( $row->rev_parent_id ) ? null : 0;
+                       if ( !isset( $row->rev_parent_id ) ) {
+                               $this->mParentId = null;
                        } else {
                                $this->mParentId  = intval( $row->rev_parent_id );
                        }
 
-                       if( !isset( $row->rev_len ) || is_null( $row->rev_len ) ) {
+                       if ( !isset( $row->rev_len ) ) {
                                $this->mSize = null;
                        } else {
                                $this->mSize = intval( $row->rev_len );