Skip to content

[5.4] Converting DatabaseQuery::castAsChar() to castAs()#45826

Merged
muhme merged 2 commits intojoomla:5.4-devfrom
Hackwar:5.4-castaschar
Aug 4, 2025
Merged

[5.4] Converting DatabaseQuery::castAsChar() to castAs()#45826
muhme merged 2 commits intojoomla:5.4-devfrom
Hackwar:5.4-castaschar

Conversation

@Hackwar
Copy link
Member

@Hackwar Hackwar commented Aug 3, 2025

Summary of Changes

DatabaseQuery::castAsChar() has been deprecated in version 2 of the Joomla database framework package for removal in version 3. We missed that at that time and will now do that in version 4 of the framework. This PR converts all calls to the correct method DatabaseQuery::castAs() with the parameter CHAR instead. The update to version 4 of the framework will come in Joomla 6, but we want to have this change as early as possible.

Testing Instructions

Codereview

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@richard67
Copy link
Member

I have tested this item ✅ successfully on 629a6b4

Tested by review.

The PR does like it is documented here: https://github.com/joomla-framework/database/blob/3.x-dev/src/DatabaseQuery.php#L574

It catches all occurrences of castAsChar calls of the database query.


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

@chmst
Copy link
Contributor

chmst commented Aug 4, 2025

I have tested this item ✅ successfully on 629a6b4

Tested by review and applied the changes to one of my applications also with own components. No error found.


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

@richard67
Copy link
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 4, 2025
@muhme
Copy link
Contributor

muhme commented Aug 4, 2025

✅ Final check before merge:

  • Checked 20 places substituted, nothing else changed
  • Followed @richard67 advice to check all places are found with:
    find . -type f -name "*\.php" -exec grep -Hn "\->castAsChar(" {} \;

@muhme muhme merged commit ffe4f43 into joomla:5.4-dev Aug 4, 2025
41 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 4, 2025
@muhme muhme added this to the Joomla! 5.4.0 milestone Aug 4, 2025
@muhme
Copy link
Contributor

muhme commented Aug 4, 2025

Thank you @Hackwar for your contribution. Thank you @richard67 and @chmst for testing.

@obuisard
Copy link
Contributor

obuisard commented Sep 4, 2025

Hello Hannes @Hackwar,
great catch about castAsChar, the removal was long overdue, but since it is code that has been removed, shouldn't that be documented? Many extensions still use it and that should be mentioned in the manual.

@richard67
Copy link
Member

There is some documentation about it in the framework where it actually has been removed: https://github.com/joomla-framework/database/blob/4.x-dev/docs/v3-to-v4-update.md

@obuisard
Copy link
Contributor

obuisard commented Sep 5, 2025

There is some documentation about it in the framework where it actually has been removed: https://github.com/joomla-framework/database/blob/4.x-dev/docs/v3-to-v4-update.md

Thank you Richard! But should these changes be documented in the general Joomla 5.4 to 6.0 manual as well? Since it is affecting Joomla 6. Just wondering.

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

Comments