Opened 2 months ago

Last modified 5 weeks ago

#13406 accepted Patch - Bug Fix

Patches to fix php count warnings with PHP 7.2

Reported by: daraden Owned by: Stuart Auchterlonie
Priority: minor Milestone: 30.1
Component: Plugin - MythWeb Version: Master Head
Severity: low Keywords:
Cc: Ticket locked: no


These patches are to resolve count() warnings when using PHP 7.2. Changes just check if the object is not null before calling the count function, otherwise the count variable is set to 0.

link to PHP manual noting the count() behavior as an incompatible change in PHP 7.2

Attachments (2)

mythcount.patch (926 bytes) - added by daraden 2 months ago.
mythtv php bindings count patch
mythwebcount.patch (2.5 KB) - added by daraden 5 weeks ago.
fixed typo in mythwebcount.patch

Download all attachments as: .zip

Change History (7)

Changed 2 months ago by daraden

Attachment: mythcount.patch added

mythtv php bindings count patch

comment:1 Changed 8 weeks ago by Peter Bennett

See also #13324, #13290

comment:2 Changed 8 weeks ago by Stuart Auchterlonie

Milestone: needs_triage30.1
Status: newaccepted

Needs backporting to fixes/29 and fixes/30

comment:3 Changed 6 weeks ago by hobbes1069

Don't know if it's the right way but I "fixed" this on Fedora using the following:

iff --git a/modules/tv/tmpl/default/detail.php b/modules/tv/tmpl/default/detail.php
index f6d1faa9..4975f415 100644
--- a/modules/tv/tmpl/default/detail.php
+++ b/modules/tv/tmpl/default/detail.php
@@ -842,7 +842,7 @@
             echo '            </ul>';
-        if (count($program->jobs['queue'])) {
+        if (is_array($program->jobs['queue']) && count($program->jobs['queue'])) {
             echo t('Queued jobs'), ':',
                  '            <ul class="-queued">';
             foreach ($program->jobs['queue'] as $job) {
@@ -856,7 +856,7 @@
             echo '            </ul>';
-        if (count($program->jobs['done'])) {
+        if (is_array($program->jobs['done']) && count($program->jobs['done'])) {
             echo t('Recently completed jobs'), ':',
                  '            <ul class="-done">';
             foreach ($program->jobs['done'] as $job) {

comment:4 Changed 5 weeks ago by hobbes1069

Would it be safe to apply the two patches to v30? I would like to fix this for Fedora / RPM Fusion.

Changed 5 weeks ago by daraden

Attachment: mythwebcount.patch added

fixed typo in mythwebcount.patch

comment:5 Changed 5 weeks ago by daraden

Should work fine with v30(patches are working on my 29 backend). files the patches modify are listed as last modified 2 or more years ago.

Note: See TracTickets for help on using tickets.