-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.2] Remove PHP 5.3 compatibility code in HTMLHelper #37178
Conversation
Technically I suppose this should be deprecated before removal. |
But Joomla 4.x is not compatible with php 5.3: requirements dated August 2021 asks at least php 7.2.5. |
This comment was marked as abuse.
This comment was marked as abuse.
I have tested this item ✅ successfully on 3a45d9a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37178. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37178. |
Thank you, nice cleanup :) |
@roland-d @laoneo This PR might need to be reverted. Otherwise, we would get some warning while calling HTMLHelper methods need to pass parameters by reference. You can test it using this simple code: $db = Factory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from('#__menu')
->where('menutype = '.$db->quote('mainmenu'));
$db->setQuery($query);
$rows = $db->loadObjectList();
$children = [];
// first pass - collect children
foreach ($rows as $v)
{
$pt = $v->parent_id;
$list = @$children[$pt] ? $children[$pt] : [];
array_push($list, $v);
$children[$pt] = $list;
}
$list = HTMLHelper::_('menu.treerecurse', 0, '', [], $children, 9999, 0, 0); Without this PR, the code works OK. With this PR applied, we are now getting warnings:
|
Then this would be correct call when the children array must be a reference:
|
That's not right. You would get the error message like:
. Normally, the method definition will define the pass by reference, when we call the method, we do not need to pass by reference. |
Summary of Changes
Removes some PHP 5.3 compatibility code in the
HTMLHelper
class. Should probably go into 5.0.Testing Instructions
Browse Joomla.
Actual result BEFORE applying this Pull Request
All works.
Expected result AFTER applying this Pull Request
All works.