Direct access to protected $doc->_links property breaks forward compat #39

Open
opened 2026-05-31 01:18:59 +00:00 by jmiller · 1 comment
Owner

Problem

In MokoOG::applySeoTags() at line 196, the code directly accesses $doc->_links:

foreach ($doc->_links as $link => $attribs) {
    if (isset($attribs['relation']) && $attribs['relation'] === 'canonical') {
        unset($doc->_links[$link]);
    }
}

_links is an internal property of HtmlDocument. This will break if Joomla changes the internal structure and may emit deprecation notices in Joomla 6.

Fix

Use Joomla's public API: $doc->getHeadData() to read and $doc->setHeadData() to write, or check for $doc->removeHeadLink() if available.

File

  • src/packages/plg_system_mokoog/src/Extension/MokoOG.php:196-199
## Problem In `MokoOG::applySeoTags()` at line 196, the code directly accesses `$doc->_links`: ```php foreach ($doc->_links as $link => $attribs) { if (isset($attribs['relation']) && $attribs['relation'] === 'canonical') { unset($doc->_links[$link]); } } ``` `_links` is an internal property of `HtmlDocument`. This will break if Joomla changes the internal structure and may emit deprecation notices in Joomla 6. ## Fix Use Joomla's public API: `$doc->getHeadData()` to read and `$doc->setHeadData()` to write, or check for `$doc->removeHeadLink()` if available. ## File - `src/packages/plg_system_mokoog/src/Extension/MokoOG.php:196-199`
jmiller added the priority: mediumbugproduction-readiness labels 2026-05-31 01:18:59 +00:00
Author
Owner

Branch created: feature/39-direct-access-to-protected-links-propert

git fetch origin
git checkout feature/39-direct-access-to-protected-links-propert
Branch created: [`feature/39-direct-access-to-protected-links-propert`](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomOpenGraph/src/branch/feature/39-direct-access-to-protected-links-propert) ```bash git fetch origin git checkout feature/39-direct-access-to-protected-links-propert ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomOpenGraph#39