? Composer Dependency Changed ? ? Pending

User tests: Successful: Unsuccessful:

avatar beat
beat
21 Jan 2022

Fixes Deprecated: Automatic conversion of false to array is deprecated in libraries/vendor/joomla/uri/src/UriHelper.php on line 50

Pull Request for Issue # none, directly fix proposal.

Summary of Changes

Another PHP 8.1 warning fix.

Testing Instructions

Just review code would be enough as it's obvious PHP 8.1 issue and fix.

Open admin aera in PHP 8.1, find this warning.

Actual result BEFORE applying this Pull Request

Deprecated: Automatic conversion of false to array is deprecated in libraries/vendor/joomla/uri/src/UriHelper.php on line 50

Expected result AFTER applying this Pull Request

Not that warning anymore.

Documentation Changes Required

none.

avatar beat beat - open - 21 Jan 2022
avatar beat beat - change - 21 Jan 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Jan 2022
Category External Library Libraries Composer Change
avatar richard67
richard67 - comment - 22 Jan 2022

I have tested this item successfully on 7f591bc

Code review. Maybe not the most elegant way to fix it, having that check inside the loop, but it works and is safe and so ok for me.


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

avatar richard67 richard67 - test_item - 22 Jan 2022 - Tested successfully
avatar beat beat - change - 22 Jan 2022
Labels Added: Composer Dependency Changed ? ?
avatar richard67
richard67 - comment - 22 Jan 2022

I have tested this item successfully on 8be1c23

Code review.


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

avatar richard67 richard67 - test_item - 22 Jan 2022 - Tested successfully
avatar beat
beat - comment - 22 Jan 2022

I have tested this item white_check_mark successfully on 7f591bcCode review. Maybe not the most elegant way to fix it, having that check inside the loop, but it works and is safe and so ok for me.

Thank you @richard67 for the reviews and feedback. After 2nd thought, found and committed a way more elegant fix proposal.

Actually the function definition itself isn't elegant, as it's returning array|bool. It could have returned an empty array instead of bool. But that was before PHP was moving to strict types.

The really elegant fix would be to change the API and return an empty array instead of bool false, and as as (bool) [] === false it would be staying compatible, but would represent strictly an API change looking at the phpdoc bloc.

avatar richard67
richard67 - comment - 22 Jan 2022

Actually the function definition itself isn't elegant, as it's returning array|bool. It could have returned an empty array instead of bool. But that was before PHP was moving to strict types.

The really elegant fix would be to change the API and return an empty array instead of bool false, and as as (bool) [] === false it would be staying compatible, but would represent strictly an API change looking at the phpdoc bloc.

Yeah, we have to live with that mess, but as far as I know it shall be cleaned up with 5.0, and that will be next year. So there is light at the end of the tunnel (I hope it's not a train) :-)

avatar Quy
Quy - comment - 22 Jan 2022

I have tested this item successfully on 8be1c23


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

avatar Quy
Quy - comment - 22 Jan 2022

I have tested this item successfully on 8be1c23


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

avatar Quy Quy - test_item - 22 Jan 2022 - Tested successfully
avatar Quy Quy - change - 22 Jan 2022
Status Pending Ready to Commit
avatar Quy
Quy - comment - 22 Jan 2022

RTC


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

avatar Quy
Quy - comment - 22 Jan 2022

RTC


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

avatar zero-24
zero-24 - comment - 23 Jan 2022

This here is a change in a composer dependency so this PR should be send against the framework's 1.x branch from where we would take it back down to the CMS.

avatar beat
beat - comment - 23 Jan 2022

This here is a change in a composer dependency so this PR should be send against the framework's 1.x branch from where we would take it back down to the CMS.

Done here: joomla-framework/uri#30

Letting you merge and/or close this PR once the framework-PR is merged.

avatar beat beat - change - 23 Jan 2022
Labels Added: ?
avatar zero-24
zero-24 - comment - 23 Jan 2022

Let us close here and once @nibra did the upstream merge and version release we can pull the changes in with an composer update.

avatar Quy Quy - change - 23 Jan 2022
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2022-01-23 20:35:01
Closed_By Quy
avatar Quy Quy - close - 23 Jan 2022

Add a Comment

Login with GitHub to post a comment