Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the audit errors page’s script-termination fix.
No open issues 🎉
What changed in this PR
Fixes the audit errors page’s JavaScript concatenation issue described in #1060, allowing extension ready scripts and subsequent scripts to run correctly.
Changes:
- Adds a trailing semicolon to the ready script that rewrites the export link, preventing it from merging with the next script.
| File | Description |
|---|---|
pages/audit.php |
Terminates the export-link ready script with a semicolon. |
Review effort: Balanced
Hipska
approved these changes
Oct 27, 2026
Molkobain
approved these changes
Oct 28, 2026
Member
|
Thanks for the PR! |
This branch has not been deployed
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.
Base information
Symptom (bug) / Objective (enhancement)
On the audit errors page (
pages/audit.php?operation=errors&...), when an extension adds a ready script whose code starts with(,[or a backtick, the browser console shows:None of the ready scripts that come after this one run, including the extension's script.
Reproduction procedure (bug)
On iTop 3.2.3
With PHP 8.4.20
Install an extension that injects a ready script starting with
(, for example:Go to Admin tools > Audit, run an audit, and click the error count of any rule that has errors
Open the browser console
Expected: the page works, and the extension's script and the other ready scripts run. Actual:
Uncaught TypeError: $(...).attr(...) is not a function, and the following ready scripts don't run.Cause (bug)
In
pages/audit.php,case 'errors', the ready script that rewrites the export link has no trailing semicolon:templates/pages/backoffice/webpage/layout.html.twigoutputs the ready scripts one after another, separated only by newlines, and extension ready scripts are added after this one. If the next script starts with(,[or a backtick, JavaScript does not insert a semicolon automatically, so the browser reads:and tries to call the jQuery object returned by
.attr()as a function.Proposed solution (bug and enhancement)
Add the missing
;at the end of that script, as the otheradd_ready_script()calls in the same file already do.Checklist before requesting a review
No unit test added: the fix is a one-character change inside a generated JavaScript string, and the bug only shows up in the browser when the page's ready scripts are concatenated, which the PHPUnit suite doesn't cover