diff vendor/symfony/console/Question/ChoiceQuestion.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 1fec387a4317
line wrap: on
line diff
--- a/vendor/symfony/console/Question/ChoiceQuestion.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/vendor/symfony/console/Question/ChoiceQuestion.php	Fri Feb 23 15:52:07 2018 +0000
@@ -34,6 +34,10 @@
      */
     public function __construct($question, array $choices, $default = null)
     {
+        if (!$choices) {
+            throw new \LogicException('Choice question must have at least 1 choice available.');
+        }
+
         parent::__construct($question, $default);
 
         $this->choices = $choices;
@@ -137,7 +141,7 @@
 
             if ($multiselect) {
                 // Check for a separated comma values
-                if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
+                if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
                     throw new InvalidArgumentException(sprintf($errorMessage, $selected));
                 }
                 $selectedChoices = explode(',', $selectedChoices);