Minor alter to regex
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 17 Apr 2017 21:42:32 +0000 (07:42 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 17 Apr 2017 21:42:32 +0000 (07:42 +1000)
CRM/Core/I18n/Schema.php
tests/phpunit/CRM/Core/I18n/SchemaTest.php

index 06a4ab9ae52127f21dbb3264477678f535867015..46bd495326e279f2d29f3e32d9a102e584d10d9d 100644 (file)
@@ -368,7 +368,7 @@ class CRM_Core_I18n_Schema {
       // CRM-19093
       // should match the civicrm table name such as: civicrm_event
       // but must not match the table name if it's a substring of another table: civicrm_events_in_cart
-      $query = preg_replace("/([^'\"])({$table})($|[^a-z_'\"])/", "\\1\\2{$dbLocale}\\3", $query);
+      $query = preg_replace("/([^'\"])({$table})(\z|[^a-z_'\"])/", "\\1\\2{$dbLocale}\\3", $query);
     }
     // uncomment the below to rewrite the civicrm_value_* queries
     // $query = preg_replace("/(civicrm_value_[a-z0-9_]+_\d+)([^_])/", "\\1{$dbLocale}\\2", $query);
index 345c2c290ee09f94fb10b614814ce57ead65fa13..245360482a1b937080e1334d22039a59316226fb 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Core_I18n_SchemaTest extends CiviUnitTestCase {
     $this->assertEquals("DELETE FROM {$expectedRewrite}", $new_query8);
     $query9 = 'INSERT INTO ' . "{$table}" . ' (foo, bar) VALUES (123, "' . "Just a {$table} string" . '")';
     $new_query9 = CRM_Core_I18n_Schema::rewriteQuery($query9);
-    $this->assertEquals('INSERT INTO ' . "{$expectedRewrite}" . ' (foo, bar) VALUES (123, "' . "Just a {$table} string)", $new_query9);
+    $this->assertEquals('INSERT INTO ' . "{$expectedRewrite}" . ' (foo, bar) VALUES (123, "' . "Just a {$table} string" . '")', $new_query9);
   }
 
 }