Skip to content

[6.2] Changelog shows all changes not just latest#48015

Open
MarkRS-UK wants to merge 9 commits into
joomla:6.2-devfrom
MarkRS-UK:changelog
Open

[6.2] Changelog shows all changes not just latest#48015
MarkRS-UK wants to merge 9 commits into
joomla:6.2-devfrom
MarkRS-UK:changelog

Conversation

@MarkRS-UK

@MarkRS-UK MarkRS-UK commented Jun 24, 2026

Copy link
Copy Markdown
Contributor
  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Change changelog code to show all changelog entries for an extension in the admin panel.

Testing Instructions

Ensure an extension that supplies more than one changelog entry is installed.
Select the extension in the System->Manage->Extensions list of the admin panel.
Click on the version number of the selected extension

Actual result BEFORE applying this Pull Request

A dialogue box appears with the changelog entry for the currently installed version.

Expected result AFTER applying this Pull Request

A dialogue box appears with ALL changelog entries.

Other comments

I wanted to make the list scroll to the currently installed version and have supplied each entry with an id for that purpose, but I don't know how to run the required javascript when the dialogue box opens.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@tecpromotion

Copy link
Copy Markdown
Contributor

@MarkRS-UK please have a look at the code style errors and fix them.

@tecpromotion tecpromotion added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jun 24, 2026
@tecpromotion tecpromotion changed the title Changelog shows all changes not just latest [6.2] Changelog shows all changes not just latest Jun 24, 2026
@MacJoom

MacJoom commented Jun 24, 2026

Copy link
Copy Markdown
Member

Thank you for your contribution. Could you please check your development/Git setup? It’s currently almost impossible to review this PR because entire files appear to have been replaced, probably due to tab or CRLF issues.

@tecpromotion

tecpromotion commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

I have tested this item 🔴 unsuccessfully on 6be3675


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48015.

Verdict: Needs one small change — the feature works, but it introduces a PHP warning on a
realistic failure path.

The pr does what it claims: the extension changelog modal (System → Manage → Extensions →
click the version) now lists all changelog versions instead of only the installed one, each
under its own version header. Confirmed working. There is one regression to fix before merge, plus a
couple of optional notes.

Verification

Tested on a clean 6.2-dev build of this PR (DDEV, PHP 8.3). Seeded an extension (com_banners) with
a changelog XML containing three versions (3.0.0 / 2.0.0 / 1.0.0, mixed change types) and exercised
the real code path (Changelog::loadFromXmlManageModel::loadChangelogFileLayout joomla.installer.changelog).

  • After (this PR): all three versions render, each with its <div id="<version>" class="changelog"> header and the correct per-type badges (security/fix/addition/change/remove/
    note) and items.
  • Before (base 6.2-dev, per the diff): only the entry whose version matched the installed
    version was kept ($latest), so a single version was shown. The behaviour change is real and
    correct.
  • Scope is sensible (4 files, +81/−90); the now-unused deprecated Changelog::get() calls are
    removed from ManageModel and the matching phpstan-baseline.neon entries are correctly dropped.

Finding (needs change) — PHP warning when the changelog is empty or the URL fails

Changelog::$changes is declared public $changes; with no default, and
ManageModel::loadChangelog() iterates it unconditionally:

foreach ($changelog->changes as $key => $entry) {   // ManageModel.php

If loadFromXml() returns no <changelog> entries (empty <changelogs>) or fails entirely
(URL 404 / changelog server unreachable)
, $changes stays null, so this becomes
foreach (null …):

Warning: foreach() argument must be of type array|object, null given

I reproduced both cases at runtime (empty <changelogs/>loadFromXml=true, changes=NULL; bad
URL 404 → loadFromXml=false, changes=NULL); both fire the warning (confirmed via CLI with full
error reporting). The old code degraded silently here (it guarded on isset($this->latest) /
get() returned null). A down/missing changelog server is a plausible real-world condition.

Real-world visibility: in the running backend the warning does not surface in the modal —
I tested the actual manage.loadChangelogRaw endpoint with Error Reporting at both default and
maximum, and in both cases the modal is simply empty (0 bytes); Joomla's runtime error handler
keeps the E_WARNING out of the output (it goes to the log). So the user-facing symptom is a silent
empty modal rather than a graceful no-op, and the unguarded foreach over a nullable property is a
code-level regression worth fixing regardless.

Suggested fix

Initialise the property to an array — one line, fixes both cases:

// libraries/src/Changelog/Changelog.php
public $changes = [];

(Optionally also guard in the model: if (empty($changelog->changes)) { return ''; }.)

Optional notes

  • Dead code: with the version-match logic gone, setVersion() / $matchVersion (and
    getVersion()) no longer affect anything — ManageModel still calls setVersion() but it is now
    a no-op. Consider removing, or leave for b/c.
  • Output escaping: the version key is echoed unescaped into both an attribute and text
    (id="<?php echo $key?>", <span><?php echo $key; ?></span>). It comes from the extension's own
    changelog XML (low risk), but $this->escape() would be more consistent with the project's
    output-escaping stance.
  • The author's note (scroll/highlight the installed version via the added id) is not implemented;
    fine for this PR's scope.

@MarkRS-UK

Copy link
Copy Markdown
Contributor Author

Thanks for that. I've implemented all of those. Tested with a valid changelog and with a broken changelog URL which simply yields a blank dialog.

Comment thread layouts/joomla/installer/changelog.php Outdated
@tecpromotion

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 6de5081


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48015.

@tecpromotion tecpromotion removed the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jun 25, 2026
@alikon

alikon commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

may i suggest to add something like

   /**
     * Update manifest `<releasedate>` element
     *
     * @var    string
     * @since  __DEPLOY_VERSION__
     */
    protected $releasedate;

to have something like

image
<changelogs>
    <changelog>
        <element>mod_changelog</element>
        <type>module</type>
        <version>1.0.0</version>
        <releasedate>2024-01-01</releasedate>
        <security>
            <item>Item A</item>
            <item>Item b</item>
        </security>
        <fix>
            <item>Item A</item>
            <item>Item b</item>
        </fix>
        <language>
            <item>Item A</item>
            <item>Item b</item>
        </language>
        <addition>
            <item>Item A</item>
            <item>Item b</item>
        </addition>
        <change>
            <item>Item A</item>
            <item>Item b</item>
        </change>
        <remove>
            <item>Item A</item>
            <item>Item b</item>
        </remove>
        <note>
            <item>Item A</item>
            <item>Item b</item>
        </note>
    </changelog>
    <changelog>
        <element>mod_changelog</element>
        <type>module</type>
        <version>1.1.0</version>
        <releasedate>2026-01-01</releasedate>
        <change>
            <item>Code clean</item>
        </change>
    </changelog>
</changelogs>

@MarkRS-UK

Copy link
Copy Markdown
Contributor Author

Seems like a good idea, but is "releasedate" a valid tag? It's not listed in the documentation.

From that point of view, I'd say this would be out of scope for this PR.

@alikon

alikon commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

It's not listed in the documentation.

not yet but, all changelogs have that information especially when you are showing all items like in this pr

@MarkRS-UK

Copy link
Copy Markdown
Contributor Author

What is that date then?

Looks to me like it's the creation date, adding "01" if a day isn't specified. Is that meant to signify version release date? That's not what I would have guessed.

@alikon

alikon commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

version release date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants