From: Alexandre Emsenhuber Date: Fri, 28 Dec 2012 12:03:06 +0000 (+0100) Subject: Correct isset() and associated checks in Revision::__construct() X-Git-Tag: 1.31.0-rc.0~21193^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=4b6a0ff9884747c49cae65b6cf9f328704d47c0f;p=lhc%2Fweb%2Fwiklou.git Correct isset() and associated checks in Revision::__construct() 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 --- diff --git a/includes/Revision.php b/includes/Revision.php index cc79c644a5..5f62e4d56f 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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 );