Index: Statement.php =================================================================== --- Statement.php (revision 13128) +++ Statement.php (working copy) @@ -184,7 +184,10 @@ // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" - $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql); + if (!empty($q)) { + $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql); + } + // remove 'foo\'bar' if (!empty($q)) { $sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql);