No Code Attached Yet bug Webservices
avatar PixedBo
PixedBo
4 Mar 2026

What happened?

Testing API to retrieve an article via ID ( /api/index.php/v1/content/articles/XXX ) you will not get the images (intro and full text) in the json response if there is an article custom field with name "images".

How to reproduce:

  • clean joomla install
  • activate token plugins
  • copy the token form your super-admin user
  • get with curl (or similar) info about a specifc article with ID. Make sure that that article has an intro and a full image set.
  • create a custom filed (i created a media field) with name "images". You can leave the custom field empty in the article.

test with something like:

curl.exe -X GET "http://localhost/test-api/api/index.php/v1/content/articles/1" -H "Authorization: Bearer xxxxxxx" -H "Accept: application/vnd.api+json"

where "1" is the ID of the article with images and "xxxxxxx" is the token of the super-admin.

Version

6.0

Expected result

a JSON with the images in the right place, something like this:

{
  "links": {
    "self": "http://localhost/test-api/api/index.php/v1/content/articles/1"
  },
  "data": {
    "type": "articles",
    "id": "2",
    "attributes": {
      ................
      "publish_up": "2026-03-04 16:30:17",
      "publish_down": null,
      "images": {
        "image_intro": "http://localhost/test-api/images/powered_by.png#joomlaImage://local-images/powered_by.png?width=294&height=44",
        "image_intro_alt": "",
        "float_intro": "",
        "image_intro_caption": "",
        "image_fulltext": "http://localhost/test-api/images/powered_by.png#joomlaImage://local-images/powered_by.png?width=294&height=44",
        "image_fulltext_alt": "",
        "float_fulltext": "",
        "image_fulltext_caption": ""
      },
      ......
      }
    }
  }
}

Actual result

The JSON returns empty images[ ] AND the custom field "images" is not present:

  "links": {
    "self": "http://localhost/test-api/api/index.php/v1/content/articles/1"
  },
  "data": {
    "type": "articles",
    "id": "1",
    "attributes": {
      "typeAlias": "com_content.article",
      "id": 1,
      "asset_id": 100,
      "title": "test1",
      "alias": "test1",
      "state": 1,
      "created": "2026-03-04 16:30:17",
      "created_by": 440,
      "created_by_alias": "",
      "modified": "2026-03-04 16:30:17",
      "modified_by": 440,
      "publish_up": "2026-03-04 16:30:17",
      "publish_down": null,
      "images": [],
      "urls": {
        "urla": "",
        "urlatext": "",
        "targeta": "",
        "urlb": "",
        "urlbtext": "",
        "targetb": "",
        "urlc": "",
        "urlctext": "",
        "targetc": ""
      },
      "version": 1,
      "metakey": "",
      "metadesc": "",
      "access": 1,
      "hits": 0,
      "metadata": {
        "robots": "",
        "author": "",
        "rights": ""
      },
      "featured": 0,
      "language": "*",
      "note": "",
      "tags": [],
      "featured_up": null,
      "featured_down": null,
      "text": "<p>test1</p> "
    },
    "relationships": {
      "category": {
        "data": {
          "type": "categories",
          "id": "2"
        }
      },
      "created_by": {
        "data": {
          "type": "users",
          "id": "440"
        }
      },
      "tags": {
        "data": []
      },
      "modified_by": {
        "data": {
          "type": "users",
          "id": "440"
        }
      }
    }
  }
}```

It seems that the custom field content replace the "images" of the article (the core one)

### System Information

joomla 6.0.3
php 8.3.14
mysql 9.1.0

### Additional Comments

_No response_
avatar PixedBo PixedBo - open - 4 Mar 2026
avatar PixedBo PixedBo - change - 4 Mar 2026
Labels Added: bug
avatar PixedBo PixedBo - labeled - 4 Mar 2026
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Mar 2026
avatar PixedBo PixedBo - change - 4 Mar 2026
The description was changed
avatar PixedBo PixedBo - edited - 4 Mar 2026
avatar PixedBo PixedBo - change - 4 Mar 2026
The description was changed
avatar PixedBo PixedBo - edited - 4 Mar 2026
avatar richard67
richard67 - comment - 5 Mar 2026

We have 2 PRs now for this issue: #47304 and #47306 . They are different, so at least one of them might not be right or complete.

avatar brianteeman
brianteeman - comment - 5 Mar 2026

They are both wrong.

avatar sadiapeerzada
sadiapeerzada - comment - 5 Mar 2026

I've created a PR that addresses the problem by:

  • Safely exposing custom_fields in both single and list article views.
  • Removing dynamic field injection to stabilize API output.
  • Ensuring proper handling of tags, images, and multilingual associations.
  • Triggering content plugins safely to maintain compatibility.

You can check out the PR here: #47309

avatar richard67
richard67 - comment - 5 Mar 2026

I've created a PR that addresses the problem by:

* Safely exposing `custom_fields` in both single and list article views.

* Removing dynamic field injection to stabilize API output.

* Ensuring proper handling of tags, images, and multilingual associations.

* Triggering content plugins safely to maintain compatibility.

You can check out the PR here: #47309

So we have 3 PRs now for the same issue. At least 2 of them are wrong.

It would really be helpful if you guys could check if there is already a PR for an issue before creating your own.

Making concurrent PRs is not really friendly to the authors of the other PRs, and it causes unnecessary work for maintainers.

avatar alikon alikon - change - 6 Mar 2026
Labels Added: Webservices
avatar alikon alikon - labeled - 6 Mar 2026
avatar Harsh63870
Harsh63870 - comment - 6 Mar 2026

Hi @richard67 and @brianteeman,
I noticed both existing PRs (#47304 and #47306) have some issues, so I wanted to explain how my PR #47317 approaches the problem differently.
Concerns with PR #47304:

  • Uses custom_field_ prefix which is verbose and inconsistent with Joomla conventions.
  • Adds JSON decoding logic which appears to be a separate concern.
  • Updates fieldsToRenderItem but does not update fieldsToRenderList, so list endpoints remain affected.
    Limitations of PR #47306:
  • The pre-population loop in displayItem() still pushes raw $field->name into fieldsToRenderItem.
    which means the serializer won't render cf_images.
  • fieldsToRenderList is not updated so /content/articles list endpoint is still affected.
  • Collision detection differs between displayItem and prepareItem.
    What PR #47309 does:
  • Uses cf_ prefix consistently across displayList, displayItem, and prepareItem.
  • Uses property_exists($item, $field->name) to detect runtime collisions.
  • Updates both fieldsToRenderItem and fieldsToRenderList.
  • Adds a Cypress test ensuring core images remain intact when a custom field is named images.

Happy to adjust anything based on feedback. Thanks for reviewing...

Add a Comment

Login with GitHub to post a comment