? ? Pending

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
30 Oct 2017

Summary of Changes

PHP 7.2 disallows the use of the count() function on non countable items (arrays or objects implementing the Countable interface). We have places in our API where null values were being returned then pushed into a count() call, this PR addresses three uses found on a cursory click through a CMS install using PHP 7.2.0RC5.

Testing Instructions

To verify:

  • Install Joomla without sample data then click to the login page. You get a countable warning coming from the Updater.php file by way of the plugin which checks for updates and sends an email notification triggering an update check. This is caused by properties in the CollectionAdapter class not being initialized as empty arrays and therefore when no updates are found the properties are still set as null versus being array.
  • After logging in, the two articles modules will give a countable warning coming from the com_content articles model. This is caused by a state value not setting an appropriate default if the state value is null.
  • Install Joomla with the testing sample data and navigate to the frontend "Single Contact" page. You get a countable warning coming from the similar tags module. This is caused by the module's helper method returning null in some conditions instead of simply returning an empty array.

Apply the patch and repeat these steps.

(If you do not reinstall before item 1, you will need to clear the update check timestamps for the plg_system_updatenotification plugin params and the Joomla! Core update site).

Expected result

Data is displayed without error.

Actual result

Errors as a result of trying to count a non-countable item.

avatar mbabker mbabker - open - 30 Oct 2017
avatar mbabker mbabker - change - 30 Oct 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Oct 2017
Category Administration com_content Libraries Modules Front End
avatar alikon alikon - test_item - 2 Nov 2017 - Tested successfully
avatar alikon
alikon - comment - 2 Nov 2017

I have tested this item successfully on 26ee013


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

avatar mbabker mbabker - change - 12 Nov 2017
Labels Added: ?
avatar roland-d roland-d - test_item - 26 Nov 2017 - Tested successfully
avatar roland-d
roland-d - comment - 26 Nov 2017

I have tested this item successfully on ca74bf9

All three cases were showing the warning running PHP 7.2RC6. After applying the patch the warnings were gone.


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

avatar 810 810 - test_item - 30 Nov 2017 - Tested successfully
avatar 810
810 - comment - 30 Nov 2017

I have tested this item successfully on ca74bf9


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

avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Nov 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 30 Nov 2017

Ready to Commit after two successful tests.

avatar rdeutz rdeutz - change - 30 Nov 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-11-30 14:27:22
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 30 Nov 2017
avatar rdeutz rdeutz - merge - 30 Nov 2017

Add a Comment

Login with GitHub to post a comment