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

Fixes #7001 - Error message: if 'modeSql' fails, error message does not...

Fixes #7001 - Error message: if 'modeSql' fails, error message does not contain a reference to the causing FE.
parent 538f0123
Pipeline #1093 passed with stage
in 1 minute and 56 seconds
......@@ -593,7 +593,7 @@ abstract class AbstractBuildForm {
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function elements($recordId, $filter = FORM_ELEMENTS_NATIVE, $feIdContainer = 0, array &$json,
public function elements($recordId, $filter, $feIdContainer, array &$json,
$modeCollectFe = FLAG_DYNAMIC_UPDATE, $htmlElementNameIdZero = false,
$storeUseDefault = STORE_USE_DEFAULT, $mode = FORM_LOAD) {
$html = '';
......@@ -640,20 +640,27 @@ abstract class AbstractBuildForm {
// for Upload FormElements, it's necessary to pre-calculate an optional given 'slaveId'.
if ($fe[FE_TYPE] === FE_TYPE_UPLOAD) {
Support::setIfNotSet($fe, FE_SLAVE_ID);
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, FE_SLAVE_ID, STORE_SYSTEM); // debug
$slaveId = Support::falseEmptyToZero($this->evaluate->parse($fe[FE_SLAVE_ID]));
$this->store->setVar(VAR_SLAVE_ID, $slaveId, STORE_VAR);
}
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, FE_VALUE, STORE_SYSTEM); // debug
$fe[FE_VALUE] = $this->processReportSyntax($fe[FE_VALUE]);
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, FE_NOTE, STORE_SYSTEM); // debug
$fe[FE_NOTE] = $this->processReportSyntax($fe[FE_NOTE]);
if (isset($fe[FE_FILL_STORE_VAR])) {
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, FE_FILL_STORE_VAR, STORE_SYSTEM); // debug
$fe[FE_FILL_STORE_VAR] = $this->evaluate->parse($fe[FE_FILL_STORE_VAR]);
$this->store->appendToStore($fe[FE_FILL_STORE_VAR], STORE_VAR);
}
// ** evaluate current FormElement **
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, 'Some of the columns of current FormElement', STORE_SYSTEM); // debug
$formElement = $this->evaluate->parseArray($fe, $skip, $debugStack);
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, 'Set language', STORE_SYSTEM); // debug
$formElement = HelperFormElement::setLanguage($formElement, $parameterLanguageFieldName);
// Some Defaults
......@@ -749,6 +756,8 @@ abstract class AbstractBuildForm {
}
}
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN, '', STORE_SYSTEM); // debug
// Log / Debug: Last FormElement has been processed.
$this->store->setVar(SYSTEM_FORM_ELEMENT, '', STORE_SYSTEM);
......@@ -784,6 +793,9 @@ abstract class AbstractBuildForm {
// Extract necessary elements
$config = OnArray::getArrayItems($formElement, [FE_LDAP_SERVER, FE_LDAP_BASE_DN, FE_LDAP_SEARCH, FE_LDAP_ATTRIBUTES]);
$this->store->setVar(SYSTEM_FORM_ELEMENT_COLUMN,
FE_LDAP_SERVER . ',' . FE_LDAP_BASE_DN . ',' . FE_LDAP_SEARCH . ',' . FE_LDAP_ATTRIBUTES, STORE_SYSTEM);
$config = $this->evaluate->parseArray($config);
if ($formElement[FE_LDAP_USE_BIND_CREDENTIALS] == 1) {
......
......@@ -68,7 +68,6 @@ class AbstractException extends \Exception {
$arrShow = $this->messageArray;
$htmlDebug = '';
$arrDebugShow = array();
$editForm='';
try {
// In a very early stage, it might be possible that Store can't be initialized: take care not to use it.
......@@ -98,15 +97,6 @@ class AbstractException extends \Exception {
$arrShow[EXCEPTION_MESSAGE] = $arrMsg[ERROR_MESSAGE_TO_USER];
}
// // Unset empty elements
// foreach ([EXCEPTION_FORM, EXCEPTION_FORM_ELEMENT, EXCEPTION_FORM_ELEMENT_COLUMN] as $key) {
// if (isset($arrShow[$key])) {
// if ($arrShow[$key] == '') {
// unset($arrShow[$key]);
// }
// }
// }
$arrDebugHidden[EXCEPTION_FILE] = $this->getFile();
$arrDebugHidden[EXCEPTION_LINE] = $this->getLine();
......@@ -128,7 +118,7 @@ class AbstractException extends \Exception {
$arrDebugHidden = OnArray::varExportArray($arrDebugHidden);
$arrDebugHidden[EXCEPTION_IP_ADDRESS] = $store->getVar(CLIENT_REMOTE_ADDRESS, STORE_CLIENT);
$arrDebugHidden[EXCEPTION_HTTP_USER_AGENT] = $store->getVar( CLIENT_HTTP_USER_AGENT, STORE_CLIENT, SANITIZE_ALLOW_ALLBUT);
$arrDebugHidden[EXCEPTION_HTTP_USER_AGENT] = $store->getVar(CLIENT_HTTP_USER_AGENT, STORE_CLIENT, SANITIZE_ALLOW_ALLBUT);
$arrDebugHidden[EXCEPTION_QFQ_COOKIE] = $store->getVar(CLIENT_COOKIE_QFQ, STORE_CLIENT, SANITIZE_ALLOW_ALNUMX);
// Debug Information
......@@ -138,14 +128,16 @@ class AbstractException extends \Exception {
// edit the broken form will be helpful.
$storeSystem = $store->getStore(STORE_SYSTEM);
if (!empty($storeSystem[SYSTEM_FORM])) {
$editForm = $this->buildFormLink($storeSystem);
$arrForm['Edit'] = $this->buildFormLink($storeSystem);
$arrForm['FE column'] = Store::getVar(SYSTEM_FORM_ELEMENT_COLUMN, STORE_SYSTEM);
}
$arrMerged = OnArray::htmlentitiesOnArray(array_merge($arrMsg, $arrDebugShow));
if (!empty($os = $arrMerged[ERROR_MESSAGE_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)) {
if (preg_match("/mysqli: 1064.*$beforeMatch.*$afterMatch/", $os)) {
$match = explode("$beforeMatch", $os, 2)[1];
$match = preg_split("/$afterMatch/", $match)[0];
......@@ -155,8 +147,11 @@ class AbstractException extends \Exception {
$arrMerged[EXCEPTION_SQL_FINAL] = $highlightedSql;
}
}
$htmlDebug = OnArray::arrayToHtmlTable(
array_merge($arrMerged, [ 'Edit' => $editForm ]), 'Debug', EXCEPTION_TABLE_CLASS);
array_merge($arrForm, $arrMerged),
'Debug', EXCEPTION_TABLE_CLASS);
$htmlDebug = str_replace("\n", "<br>", $htmlDebug);
$arrDebugHiddenClean = OnArray::htmlentitiesOnArray($arrDebugHidden);
......@@ -236,11 +231,12 @@ class AbstractException extends \Exception {
$linkFormElement = $link->renderLink(TOKEN_SIP . '|' . TOKEN_BOOTSTRAP_BUTTON . '|' . TOKEN_PAGE .
':' . $storeSystem[SYSTEM_EDIT_FORM_PAGE] . '&' . CLIENT_FORM . '=' . FORM_NAME_FORM_ELEMENT . '&' .
CLIENT_RECORD_ID . '=' . $storeSystem[SYSTEM_FORM_ELEMENT_ID] . '|' .
TOKEN_TEXT . ':' . $storeSystem[SYSTEM_FORM_ELEMENT_ID]);
TOKEN_TEXT . ':' . $storeSystem[SYSTEM_FORM_ELEMENT]);
}
} catch (\exception $e) {
// none, should rise up
return "Error build direct 'Form-Edit-Link'";
}
return 'Form: ' . $linkForm . '&nbsp;&nbsp; FormElement: ' . $linkFormElement;
......
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