From: Aaron Schulz Date: Fri, 2 Sep 2016 20:09:19 +0000 (-0700) Subject: Fixup some rc_* fields if empty for STRICT mode in RecentChange X-Git-Tag: 1.31.0-rc.0~5737^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=a448eafb7d635558c3121f5bd7bd27eb3c8001e5;p=lhc%2Fweb%2Fwiklou.git Fixup some rc_* fields if empty for STRICT mode in RecentChange Change-Id: Ie3849f5df8bc4f98d668ed024a052523357d3514 --- diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index df75ae389e..a5d1fc5f71 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -285,6 +285,17 @@ class RecentChange { $this->mAttribs['rc_ip'] = ''; } + # Strict mode fixups (not-NULL fields) + foreach ( [ 'minor', 'bot', 'new', 'patrolled', 'deleted' ] as $field ) { + $this->mAttribs["rc_$field"] = (int)$this->mAttribs["rc_$field"]; + } + # ...more fixups (NULL fields) + foreach ( [ 'old_len', 'new_len' ] as $field ) { + $this->mAttribs["rc_$field"] = isset( $this->mAttribs["rc_$field"] ) + ? (int)$this->mAttribs["rc_$field"] + : null; + } + # If our database is strict about IP addresses, use NULL instead of an empty string if ( $dbw->strictIPs() && $this->mAttribs['rc_ip'] == '' ) { unset( $this->mAttribs['rc_ip'] ); @@ -776,7 +787,7 @@ class RecentChange { 'rc_comment' => $logComment, 'rc_this_oldid' => $revId, 'rc_last_oldid' => 0, - 'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot', true ) : 0, + 'rc_bot' => $user->isAllowed( 'bot' ) ? (int)$wgRequest->getBool( 'bot', true ) : 0, 'rc_ip' => self::checkIPAddress( $ip ), 'rc_patrolled' => $markPatrolled ? 1 : 0, 'rc_new' => 0, # obsolete