Remove the current_result global variable

Replaces it with a local variable.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
Maurício Meneghini Fauth 2025-01-10 18:08:36 -03:00
parent 728f682c9e
commit 657d1d0784
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
2 changed files with 3 additions and 8 deletions

View File

@ -2306,13 +2306,12 @@
<code><![CDATA[$rowId]]></code>
</MixedArgumentTypeCoercion>
<MixedAssignment>
<code><![CDATA[$GLOBALS['current_result']]]></code>
<code><![CDATA[$isUpload]]></code>
<code><![CDATA[$repopulate]]></code>
<code><![CDATA[$whereClause]]></code>
</MixedAssignment>
<PossiblyInvalidArgument>
<code><![CDATA[$GLOBALS['current_result']]]></code>
<code><![CDATA[$currentResult]]></code>
</PossiblyInvalidArgument>
<PossiblyNullArgument>
<code><![CDATA[$isUpload]]></code>

View File

@ -54,8 +54,6 @@ class ChangeController implements InvocableController
public function __invoke(ServerRequest $request): Response
{
$GLOBALS['current_result'] ??= null;
$this->pageSettings->init('Edit');
$this->response->addHTML($this->pageSettings->getErrorHTML());
$this->response->addHTML($this->pageSettings->getHTML());
@ -224,9 +222,7 @@ class ChangeController implements InvocableController
InsertEdit::$pluginScripts = [];
foreach ($rows as $rowId => $currentRow) {
$GLOBALS['current_result'] = is_array($result) && isset($result[$rowId])
? $result[$rowId]
: $result;
$currentResult = is_array($result) && isset($result[$rowId]) ? $result[$rowId] : $result;
$repopulate = [];
$checked = true;
if (isset(self::$unsavedValues[$rowId])) {
@ -242,7 +238,7 @@ class ChangeController implements InvocableController
UrlParams::$params,
$tableColumns,
$commentsMap,
$GLOBALS['current_result'],
$currentResult,
$insertMode,
$currentRow ?: [],
$isUpload,