bug PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Denitz
Denitz
28 Sep 2023

Summary of Changes

Prefer foreach() over for(), especially for iterating objects. Foreach is simpler.

Testing Instructions

Apply patch.

Actual result BEFORE applying this Pull Request

Complex code.

Expected result AFTER applying this Pull Request

Simple code.

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

f30976f 28 Sep 2023 avatar Denitz fix
avatar joomla-cms-bot joomla-cms-bot - change - 28 Sep 2023
Category Administration com_categories com_finder com_joomlaupdate com_login com_menus com_modules com_users Front End com_banners com_contact com_content Libraries Plugins
avatar Denitz Denitz - open - 28 Sep 2023
avatar Denitz Denitz - change - 28 Sep 2023
Status New Pending
avatar Denitz Denitz - change - 30 Sep 2023
Labels Added: PR-5.0-dev
avatar HLeithner HLeithner - edited - 30 Sep 2023
avatar HLeithner HLeithner - change - 30 Sep 2023
Title
5.0 foreach usage
[5.1] foreach usage
avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar Denitz Denitz - change - 15 Oct 2023
Labels Added: Feature
avatar Denitz Denitz - change - 15 Oct 2023
Labels Added: PR-5.1-dev
avatar rdeutz
rdeutz - comment - 16 Oct 2023

This needs to be done carefully because a foreach makes a copy of the array and works with the copy so a foreach consume more memory. So if you've a large array you can hit the memory_limit, if it is set to a low value.

avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[5.1] foreach usage
[5.2] foreach usage
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] foreach usage
[5.3] foreach usage
avatar HLeithner HLeithner - edited - 2 Sep 2024
avatar Hackwar Hackwar - change - 3 Sep 2024
Title
[5.3] foreach usage
[5.2] foreach usage
avatar Hackwar Hackwar - edited - 3 Sep 2024
avatar Hackwar Hackwar - change - 11 Sep 2024
Labels Added: bug PR-5.2-dev
Removed: Feature PR-5.0-dev PR-5.1-dev
avatar Hackwar
Hackwar - comment - 12 Sep 2024

Thank you for your contribution @Denitz!

avatar Hackwar Hackwar - change - 12 Sep 2024
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-09-12 10:23:24
Closed_By Hackwar
avatar Hackwar Hackwar - close - 12 Sep 2024
avatar Hackwar Hackwar - merge - 12 Sep 2024

Add a Comment

Login with GitHub to post a comment