Browse Source

Fix regex for PHP 7.3.

ADmad 7 years ago
parent
commit
e2891f6172
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Database/SqlDialectTrait.php

+ 2 - 2
src/Database/SqlDialectTrait.php

@@ -60,7 +60,7 @@ trait SqlDialectTrait
         }
 
         // Alias.field AS thing
-        if (preg_match('/^([\w-]+(\.[\w-\s]+|\(.*\))*)\s+AS\s*([\w-]+)$/i', $identifier, $matches)) {
+        if (preg_match('/^([\w-]+(\.[\w\s-]+|\(.*\))*)\s+AS\s*([\w-]+)$/i', $identifier, $matches)) {
             return $this->quoteIdentifier($matches[1]) . ' AS ' . $this->quoteIdentifier($matches[3]);
         }
 
@@ -72,7 +72,7 @@ trait SqlDialectTrait
             return $this->_startQuote . $field . $this->_endQuote . $matches[2];
         }
 
-        if (preg_match('/^[\w-_\s]*[\w-_]+/', $identifier)) {
+        if (preg_match('/^[\w_\s-]*[\w_-]+/', $identifier)) {
             return $this->_startQuote . $identifier . $this->_endQuote;
         }