Commit e6d462f5 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #7431: Show initial SQL statement. Reporting of FE.id has been fixed earlier.

parent 658fa8af
Pipeline #1105 passed with stage
in 1 minute and 57 seconds
......@@ -113,7 +113,7 @@ class Evaluate {
* Token to replace have to be enclosed by '{{' and '}}'
*
* @param string $line
* @param string $sqlMode ROW_IMPLODE | ROW_REGULAR | ... - might be overwritten in $line by '{{!...'
* @param string $sqlMode ROW_IMPLODE | ROW_REGULAR | ... - might be overwritten in $line by '{{!...'
* @param int $recursion
*
* @param array $debugStack
......@@ -125,29 +125,31 @@ class Evaluate {
* @throws UserReportException
*/
public function parse($line, $sqlMode = ROW_IMPLODE_ALL, $recursion = 0, &$debugStack = array(), &$foundInStore = '') {
$flagTokenReplaced = false;
if ($recursion > 4) {
throw new qfq\UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'Recursion too deep', ERROR_MESSAGE_SUPPORT => "Recursion too deep ($recursion). Line: $line"]),
throw new qfq\UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Recursion too deep', ERROR_MESSAGE_SUPPORT => "Level: $recursion, Line: $line"]),
ERROR_RECURSION_TOO_DEEP);
}
$result = $line;
$debugIndent = str_repeat(' ', $recursion);
$debugLocal[] = $debugIndent . "PARSE: $result";
$debugLocal[] = $debugIndent . "Parse: $result";
$posFirstClose = strpos($result, $this->endDelimiter);
// $this->store->setVar(SYSTEM_SQL_RAW, $line, STORE_SYSTEM);
// Variables like 'fillStoreVar' might contain SQL statements. Put them in store in case a DB exception is thrown.
$this->store->setVar(SYSTEM_SQL_RAW, $line, STORE_SYSTEM);
while ($posFirstClose !== false) {
$posMatchOpen = strrpos(substr($result, 0, $posFirstClose), $this->startDelimiter);
if ($posMatchOpen === false) {
throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Missing open delimiter', ERROR_MESSAGE_SUPPORT => "Missing open delimiter: $result"]),
json_encode([ERROR_MESSAGE_TO_USER => 'Missing open delimiter', ERROR_MESSAGE_SUPPORT => "Text: $result"]),
ERROR_MISSING_OPEN_DELIMITER);
}
......@@ -160,7 +162,7 @@ class Evaluate {
// newline
$debugLocal[] = '';
$debugLocal[] = $debugIndent . "REPLACE: $match";
$debugLocal[] = $debugIndent . "Replace: $match";
if ($foundInStore === '') {
......
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