From 8a9fccbcc86ec5a6bbcb3f2354b49bc49dd1233f Mon Sep 17 00:00:00 2001 From: Matthias Mullie Date: Tue, 27 May 2014 15:29:27 +0200 Subject: [PATCH] Fix for tinyint(1)'s not accepting '' These boolean values go through DatabaseBase::makeList, which passes them along to DatabaseBase::addQuotes, which shoves the value through DatabaseMysqlBase::strencode, which in turn passes it on to DatabaseMysqli::mysqlRealEscapeString, which eventually calls mysqli::real_escape_string on it. This last one will turn trues into '1' and falses into ''. MySQL (or at least my version, 5.6.17 Homebrew) complains about receiving incorrect integer value '' for these tinyint(1) columns. Bug: T67807 Change-Id: Iaef98c08589370f9288c1f3c80803b1a16b2506e --- Views/AbuseFilterViewEdit.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Views/AbuseFilterViewEdit.php b/Views/AbuseFilterViewEdit.php index 2a2f7420b..177afca29 100755 --- a/Views/AbuseFilterViewEdit.php +++ b/Views/AbuseFilterViewEdit.php @@ -151,6 +151,14 @@ class AbuseFilterViewEdit extends AbuseFilterView { $newRow['af_throttled'] = $newRow['af_throttled'] && !$newRow['af_enabled']; $newRow['af_id'] = $new_id; // ID. + // T67807 + // integer 1's & 0's might be better understood than booleans + $newRow['af_enabled'] = (int) $newRow['af_enabled']; + $newRow['af_hidden'] = (int) $newRow['af_hidden']; + $newRow['af_throttled'] = (int) $newRow['af_throttled']; + $newRow['af_deleted'] = (int) $newRow['af_deleted']; + $newRow['af_global'] = (int) $newRow['af_global']; + $dbw->replace( 'abuse_filter', array( 'af_id' ), $newRow, __METHOD__ ); if ( $is_new ) {