Closed td204 closed 1 year ago
@td204 Not sure I follow the fix however. I think a better solution if I understand your issue is to use if (min($obj->canIncludeInGoogleSitemap())) {
which will return the minimum value (if it is an array rather than boolean).
min() is triggering a E_WARNING on an empty array. In our use case there is always only one item in the array, but as you mention it I believe this might not be the best way, possibly multiple values from multiple extensions can be in the array? min() would work, but I worry about the empty arrays. An extra check in this if statement looks like triggering unnecessary performance issues.
That might be solved with a if (!empty($var) && min($var)) {
Fixes #166
canIncludeInGoogleSitemap()
returns an array, with one item which can befalse
, e.g.$array[0] = false;
GoogleSitemap.php checks as follows:
Which will always return
true
if it is an array with count > 0, regardless of the value in first item.