Dutchento / m2-vatfallback

Vatfallback module provides an extra API based validation and a fallback offline regex validation for the unstable VIES database used by Magento
https://www.dutchento.org
MIT License
37 stars 17 forks source link

Regex validator may error out on a vat number #21

Closed mkor closed 5 years ago

mkor commented 5 years ago
  [Exception]                                                                                                                                                                      
  Warning: preg_match(): No ending delimiter '^' found in vendor/dutchento/m2-vatfallback/Service/Validate/Regex.php on line 39

I get this error when running the following command: mag vat:validate de d1111111

possible fix:


+++ vendor/dutchento/m2-vatfallback/Service/Validate/Regex.php  2019-01-29 10:21:00.936167458 +0100
@@ -35,5 +35,5 @@
     {
         // as fallback use a pattern that always validates
-        $regex = $this->vatPatternMap[$countryIso2] ?? '.*' ;
+        $regex = $this->vatPatternMap[$countryIso2] ?? '#^.*$#' ;

         return (bool)preg_match($regex, $vatNumber);```
JeroenBoersma commented 5 years ago

Fixed in https://github.com/Dutchento/m2-vatfallback/pull/22/commits/5fe700134e063523d180f5d9d90f65415944b74a