I experienced a scenario where I was testing an install package (which was corrupt) and it brought to light a couple of PHP notices in the JInstallerHelper
class.
libraries/cms/installer/helper.php line 197 & 221
$dirList = array_merge(JFolder::files($extractdir, ''), JFolder::folders($extractdir, ''));
As JFolder::files()
& JFolder::folders()
can return false
which would break array_merge()
. One solution would be type casting:
$dirList = array_merge((array)JFolder::files($extractdir, ''), (array)JFolder::folders($extractdir, ''));
if (!count($files))
Again JFolder::files()
could return false
so the count()
of false
would be 1 as opposed to 0. (see: http://php.net/manual/en/function.count.php#example-5167) Therefore as this is a false positive may I suggest something like:
if (!$files || !count($files))
or
if (!is_array($files) || !count($files))
If everyone likes the suggestions I will happily create a Pull Request.
Labels |
Added:
?
|
@bassmanpaul can you add a PR with that changes? Here is a simple step by step guide how to do it: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-02-09 16:48:31 |
Closed_By | ⇒ | zero-24 |
Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/6000
Closing as we have a PR thanks @bassmanpaul
A PR would be awesome thanks! Awesome spot!