Put some upper limit here
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 3 May 2008 04:17:03 +0000 (04:17 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 3 May 2008 04:17:03 +0000 (04:17 +0000)
includes/api/ApiBase.php

index d8bea66..0b496b9 100644 (file)
@@ -508,7 +508,10 @@ abstract class ApiBase {
        protected function parseMultiValue($valueName, $value, $allowMultiple, $allowedValues) {
                if( trim($value) === "" )
                        return array();
-               $valuesList = explode('|', $value);
+               $valuesList = explode('|', $value,51); // some kind of limit is needed here!
+               if( count($valuesList) == 51 ) {
+                       $junk = array_pop($valuesList); // kill last jumbled param
+               }
                if (!$allowMultiple && count($valuesList) != 1) {
                        $possibleValues = is_array($allowedValues) ? "of '" . implode("', '", $allowedValues) . "'" : '';
                        $this->dieUsage("Only one $possibleValues is allowed for parameter '$valueName'", "multival_$valueName");