diff --git a/library/Zend/Db/Statement.php b/library/Zend/Db/Statement.php index 46d175c..763594d 100644 --- a/library/Zend/Db/Statement.php +++ b/library/Zend/Db/Statement.php @@ -208,7 +208,11 @@ protected function _stripQuoted($sql) // values and delimited identifiers stripped out // remove "foo\"bar" $sql = preg_replace("/\"(\\\\\"|[^\"])*\"/Us", '', $sql); - + if ($sql === null) { + // this preg_replace call can return NULL in case of error (PREG_BACKTRACK_LIMIT_ERROR). + // In this case the result of this method will be an empty string. + return ''; + } // get the character for delimited id quotes, // this is usually " but in MySQL is ` $d = $this->_adapter->quoteIdentifier('a'); @@ -220,6 +224,11 @@ protected function _stripQuoted($sql) $de = preg_quote($de); // Note: $de and $d where never used..., now they are: $sql = preg_replace("/$d($de|\\\\{2}|[^$d])*$d/Us", '', $sql); + if ($sql === null) { + // this preg_replace call can return NULL in case of error (PREG_BACKTRACK_LIMIT_ERROR). + // In this case the result of this method will be an empty string. + return ''; + } return $sql; }