Fix illegal string offset warnings when deleting multiple DB mapping rows (issue #61)#128
Merged
Merged
Conversation
… DB string entries causing illegal string offset warnings on multi-delete Agent-Logs-Url: https://github.com/rsyslog/loganalyzer/sessions/8cc355cc-e8e5-4ad4-9036-96d54e841b8d Co-authored-by: alorbach <1675286+alorbach@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
alorbach
May 6, 2026 11:39
View session
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the second (and any subsequent) delete of a mapping row, the edit handler re-loads all mappings from DB as plain strings, but
$_POST['Mappings']only contains the currently-visible subset. The rebuild loop only overwrites present keys, leaving removed fields as raw strings in$content['SUBMAPPINGS']. The display loop then hits them with array-offset syntax →Illegal string offset 'MappingCaption'/'MappingInternalID'/ etc.Changes
src/admin/dbmappings.php— Reset$content['SUBMAPPINGS']to[]before rebuilding from$_POST['Mappings']. POST data is the authoritative form state; DB-loaded entries for already-removed fields must not survive into the display loop.tests/php/Unit/DbMappingSubMappingsTest.php— New PHPUnit regression test with four cases: confirms the buggy path leaves stale string entries, the fixed path produces only arrays for POST-present fields, and sequential deletes stay clean.Summary by cubic
Fixes "Illegal string offset" warnings when deleting multiple database mapping rows (issue #61) by resetting
$content['SUBMAPPINGS']before rebuilding from$_POST['Mappings'].Adds PHPUnit regression tests that cover the buggy path and ensure sequential deletes remain clean.
Written for commit 6512092. Summary will update on new commits.