Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed preg_replace deprecated error in PHP 5.5
  • Loading branch information
WanWizard committed Aug 8, 2013
1 parent 3c6f046 commit 270ba79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/database/connection.php
Expand Up @@ -635,8 +635,10 @@ public function quote_identifier($value)

if (strpos($value, '"') !== false)
{
// required for PHP 5.5- (no access to $this in closure)
$that = $this;
// Quote the column in FUNC("ident") identifiers
return preg_replace('/"(.+?)"/e', '$this->quote_identifier("$1")', $value);
return preg_replace_callback('/"(.+?)"/', function ($matches) use($that) { return $that->quote_identifier($matches[1]); }, $value);
}
elseif (preg_match("/^'(.*)?'$/", $value))
{
Expand Down

0 comments on commit 270ba79

Please sign in to comment.