Commit ce066ba3 authored by Marc Egger's avatar Marc Egger
Browse files

AbstractException.php: fixed problem with empty $match in sql syntax highlighting.

parent 529fb93a
Pipeline #1122 passed with stage
in 1 minute and 41 seconds
......@@ -136,16 +136,20 @@ class AbstractException extends \Exception {
$arrMerged = OnArray::htmlentitiesOnArray(array_merge($arrMsg, $arrDebugShow));
if (!empty($os = $arrMerged[ERROR_MESSAGE_OS] ?? '')) {
// $arrMerged[EXCEPTION_SQL_FINAL] = self::sqlHighlightError($os);
$beforeMatch = htmlentities("the right syntax to use near '", ENT_QUOTES);
$afterMatch = htmlentities("' at line [0-9]*$", ENT_QUOTES);
if (preg_match("/mysqli: 1064.*$beforeMatch.*$afterMatch/", $os)) {
$match = explode("$beforeMatch", $os, 2)[1];
$match = preg_split("/$afterMatch/", $match)[0];
$splitSql = explode($match, $arrMerged[EXCEPTION_SQL_FINAL]);
$match = Support::wrapTag('<span class="qfq-wavy-underline">', $match);
$highlightedSql = implode($match, $splitSql);
$arrMerged[EXCEPTION_SQL_FINAL] = $highlightedSql;
if(!empty($match )) {
$splitSql = explode($match, $arrMerged[EXCEPTION_SQL_FINAL]);
$match = Support::wrapTag('<span class="qfq-wavy-underline">', $match);
$highlightedSql = implode($match, $splitSql);
$arrMerged[EXCEPTION_SQL_FINAL] = $highlightedSql;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment