Skip to content

Commit

Permalink
DibiTranslator: Colon escaped with a backslash will be ignored in sub…
Browse files Browse the repository at this point in the history
…stitution.
  • Loading branch information
PetrP committed Jun 18, 2010
1 parent ecc0df5 commit 5d9c165
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dibi/libs/DibiTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,8 @@ private function delimite($value)
public static function substitute($value)
{
if (strpos($value, ':') !== FALSE) { // provide substitution
return preg_replace_callback('#:([^:\s]*):#', array(__CLASS__, 'subCb'), $value);
$value = preg_replace_callback('#(?<!\\\\):((.(?<!(?<!\\\\):))*)(?<!\\\\):#', array(__CLASS__, 'subCb'), $value);
return str_replace('\:', ':', $value);
}
return $value;
}
Expand All @@ -594,8 +595,8 @@ public static function substitute($value)
*/
private static function subCb($m)
{
$m = $m[1];
return isset(dibi::$substs[$m]) ? dibi::$substs[$m] : call_user_func(dibi::$substFallBack, $m);
$m = str_replace('\:', ':', $m[1]);
return str_replace(':', '\:', isset(dibi::$substs[$m]) ? dibi::$substs[$m] : call_user_func(dibi::$substFallBack, $m));
}

}

0 comments on commit 5d9c165

Please sign in to comment.