Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/345083 )

Change subject: Fix for queries with non-ASCII characters in table and field 
names
......................................................................

Fix for queries with non-ASCII characters in table and field names

Change-Id: I15d1b6b064918ba8c4637e41b9ca84951bd22faf
---
M CargoSQLQuery.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/83/345083/2

diff --git a/CargoSQLQuery.php b/CargoSQLQuery.php
index 153e8f0..59df73c 100644
--- a/CargoSQLQuery.php
+++ b/CargoSQLQuery.php
@@ -440,7 +440,10 @@
                        $fieldName = null;
                        $description = new CargoFieldDescription();
 
-                       $fieldPattern = '/^([-\w$]+)([.]([-\w$]+))?$/';
+                       // We use \p{L} instead of \w here in order to handle
+                       // accented and other non-ASCII characters in table
+                       // and field names.
+                       $fieldPattern = '/^([-_\p{L}$]+)([.]([-_\p{L}$]+))?$/u';
                        $fieldPatternFound = preg_match( $fieldPattern, 
$origFieldName, $fieldPatternMatches );
                        $stringPatternFound = false;
                        $hasFunctionCall = false;
@@ -467,7 +470,7 @@
                                if ( ! $stringPatternFound ) {
                                        $noQuotesOrigFieldName = 
CargoUtils::removeQuotedStrings( $origFieldName );
 
-                                       $functionCallPattern = '/\w\s*\(/';
+                                       $functionCallPattern = '/\p{L}\s*\(/';
                                        $hasFunctionCall = preg_match( 
$functionCallPattern, $noQuotesOrigFieldName );
                                }
                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15d1b6b064918ba8c4637e41b9ca84951bd22faf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to