Ed Hoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260531

Change subject: Fix HOLDS RegEx eating non-identifier characters when replacing 
field name
......................................................................

Fix HOLDS RegEx eating non-identifier characters when replacing field name

Fix HOLDS RegEx eating non-identifier characters when replacing field name

Change-Id: Iebd2cdaa294a4f97022da87a89d90d79d111de90
---
M CargoSQLQuery.php
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/31/260531/1

diff --git a/CargoSQLQuery.php b/CargoSQLQuery.php
index 69c30ea..a10f2e4 100644
--- a/CargoSQLQuery.php
+++ b/CargoSQLQuery.php
@@ -593,6 +593,7 @@
                        $fieldName = $virtualField['fieldName'];
                        $tableName = $virtualField['tableName'];
                        $foundLikeMatch1 = $foundMatch1 = $foundLikeMatch2 = 
$foundMatch2 = false;
+                       $likePattern1 = $likePattern2 = '';
                        $patternSuffix = '\s+(HOLDS)\s+(LIKE)?/i';
                        $throwException = false;
 
@@ -631,6 +632,9 @@
                                        'table2' => $fieldTableName,
                                        'field2' => '_rowID'
                                );
+                               $likePattern1 = str_replace( '([^\w$.]|^)', 
'\\b', $likePattern1);
+                               $likePattern2 = str_replace( '([^\w$.]|^)', 
'\\b', $likePattern2);
+
                                if ( $foundLikeMatch1 ) {
                                        $this->mWhereStr = preg_replace( 
$likePattern1, "$fieldTableName._value LIKE ",
                                                $this->mWhereStr );

-- 
To view, visit https://gerrit.wikimedia.org/r/260531
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebd2cdaa294a4f97022da87a89d90d79d111de90
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Ed Hoo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to