Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / Input / FilterOptions.php
index 113b8c94498df7128a7e75665a08fec1c67aa225..d77a04fb70b3c5834f9081f6209b0f9742b674c9 100644 (file)
@@ -56,7 +56,7 @@ class FilterOptions
         }
 
         if (!$this->stringIsRegex($pattern)) {
-            $pattern = '/' . preg_quote($pattern, '/') . '/';
+            $pattern = '/' . \preg_quote($pattern, '/') . '/';
         }
 
         if ($insensitive = $input->getOption('insensitive')) {
@@ -91,7 +91,7 @@ class FilterOptions
      */
     public function match($string, array &$matches = null)
     {
-        return $this->filter === false || (preg_match($this->pattern, $string, $matches) xor $this->invert);
+        return $this->filter === false || (\preg_match($this->pattern, $string, $matches) xor $this->invert);
     }
 
     /**
@@ -121,7 +121,7 @@ class FilterOptions
      */
     private function stringIsRegex($string)
     {
-        return substr($string, 0, 1) === '/' && substr($string, -1) === '/' && strlen($string) >= 3;
+        return \substr($string, 0, 1) === '/' && \substr($string, -1) === '/' && \strlen($string) >= 3;
     }
 
     /**
@@ -133,12 +133,13 @@ class FilterOptions
      */
     private function validateRegex($pattern)
     {
-        set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
+        \set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
         try {
-            preg_match($pattern, '');
+            \preg_match($pattern, '');
         } catch (ErrorException $e) {
-            throw new RuntimeException(str_replace('preg_match(): ', 'Invalid regular expression: ', $e->getRawMessage()));
+            \restore_error_handler();
+            throw new RuntimeException(\str_replace('preg_match(): ', 'Invalid regular expression: ', $e->getRawMessage()));
         }
-        restore_error_handler();
+        \restore_error_handler();
     }
 }