Sumit has uploaded a new change for review. https://gerrit.wikimedia.org/r/181678
Change subject: Database.php:Changed makeList to treat 'NULL' separately ...................................................................... Database.php:Changed makeList to treat 'NULL' separately Database::makeList() has been changed to check if 'NULL' is present in array while building IN clause. if yes, do not process the 'NULL' and concatenate " $field IS NULL" to the expression after the IN clause Bug: T50853 Change-Id: I94a273da0f935a9bf08a4986d81b53fc1848d2a7 --- M includes/db/Database.php 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/78/181678/1 diff --git a/includes/db/Database.php b/includes/db/Database.php index 33c5cfb..bcab8c1 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2138,6 +2138,9 @@ $list = ''; foreach ( $a as $field => $value ) { + if($value === null && mode == LIST_COMMA){ + continue;//do not process if array field is null while building IN clause + } if ( !$first ) { if ( $mode == LIST_AND ) { $list .= ' AND '; @@ -2165,6 +2168,10 @@ $list .= $field . " = " . $this->addQuotes( $value[0] ); } else { $list .= $field . " IN (" . $this->makeList( $value ) . ") "; + //if null is present in array, treat it separate from IN clause + if(in_array(null, $value)){ + $list .= " OR $field IS NULL"; + } } } elseif ( $value === null ) { if ( $mode == LIST_AND || $mode == LIST_OR ) { -- To view, visit https://gerrit.wikimedia.org/r/181678 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I94a273da0f935a9bf08a4986d81b53fc1848d2a7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Sumit <asthana.sumi...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits