Skip to content

Fix E_WARNING: array offset on null $INFO in _htmlform()#356

Open
eduardomozart wants to merge 5 commits intosplitbrain:masterfrom
eduardomozart:copilot/fix-warning-array-offset-null
Open

Fix E_WARNING: array offset on null $INFO in _htmlform()#356
eduardomozart wants to merge 5 commits intosplitbrain:masterfrom
eduardomozart:copilot/fix-warning-array-offset-null

Conversation

@eduardomozart
Copy link

$INFO is not initialized in CLI contexts (e.g., aichat's createEmbeddings), causing E_WARNING: Trying to access array offset on null when _htmlform() unconditionally accesses $INFO['id'].

Changes

  • syntax.php_htmlform(): Guard $INFO['id'] with isset(), falling back to $ID — consistent with the same pattern already used in prepareNamespacetemplateReplacements() (line 578)
// Before
$form->addHidden('id', $INFO['id']);

// After
global $ID;
$localid = isset($INFO['id']) ? $INFO['id'] : $ID;
$form->addHidden('id', $localid);

eduardomozart and others added 5 commits October 1, 2024 00:47
This PR checks if form is dirty (aka. has been changed) before exiting the page, preventing that user looses it changes if it exits the page after changing the form data.
…allback to $ID

Co-authored-by: eduardomozart <2974895+eduardomozart@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants