Fz-29 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371574 )

Change subject: Fix: No comma escaping for hierarchy structure input
......................................................................

Fix: No comma escaping for hierarchy structure input

Change-Id: Ifbaaade0706ad5a6a008502ade782fcc6db58b50
---
M CargoFieldDescription.php
1 file changed, 9 insertions(+), 8 deletions(-)


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

diff --git a/CargoFieldDescription.php b/CargoFieldDescription.php
index 6c78859..23b0646 100644
--- a/CargoFieldDescription.php
+++ b/CargoFieldDescription.php
@@ -69,13 +69,13 @@
                                                // already used to separate
                                                // "extra parameters", so just
                                                // hardcode it to a semicolon.
+                                               $allowedValuesArray = array();
                                                if( 
$fieldDescription->mIsHierarchy == true ) {
                                                        // $paramValue contains 
"*" hierarchy structure
                                                        
$fieldDescription->mHierarchyStructure = trim( $paramValue );
                                                        // now make the allowed 
values param similar to the syntax
                                                        // used by other fields
                                                        $hierarchyNodesArray = 
explode( "\n", $paramValue );
-                                                       $allowedValuesArray = 
array();
                                                        foreach ( 
$hierarchyNodesArray as $node ) {
                                                                // Remove 
prefix of multiple "*"
                                                                
$allowedValuesArray[] = preg_replace( '/^[*]*/', '', $node );
@@ -83,14 +83,15 @@
                                                } else {
                                                        $delimiter = ',';
                                                        $allowedValuesStr = 
str_replace( "\\$delimiter", "\a", $paramValue );
-                                                       $allowedValuesArray = 
explode( $delimiter, $allowedValuesStr );
+                                                       $allowedValuesTempArray 
= explode( $delimiter, $allowedValuesStr );
+                                                       foreach ( 
$allowedValuesTempArray as $i => $value ) {
+                                                               if ( $value == 
'' ) continue;
+                                                               // Replace beep 
back with delimiter, trim.
+                                                               $value = 
str_replace( "\a", $delimiter, trim( $value ) );
+                                                               
$allowedValuesArray[] = $value;
+                                                       }
                                                }
-                                               foreach ( $allowedValuesArray 
as $i => $value ) {
-                                                       if ( $value == '' ) 
continue;
-                                                       // Replace beep back 
with delimiter, trim.
-                                                       $value = str_replace( 
"\a", $delimiter, trim( $value ) );
-                                                       
$fieldDescription->mAllowedValues[] = $value;
-                                               }
+                                               
$fieldDescription->mAllowedValues = $allowedValuesArray;
                                        } elseif ( $paramKey == 'size' ) {
                                                $fieldDescription->mSize = 
$paramValue;
                                        } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbaaade0706ad5a6a008502ade782fcc6db58b50
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Fz-29 <f29ah...@gmail.com>

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

Reply via email to