Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#13406 closed Patch - Bug Fix (fixed)

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

Description

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.2https://secure.php.net/manual/en/migration72.incompatible.php

Attachments (2)

mythcount.patch (926 bytes ) - added by daraden 7 years ago.
mythtv php bindings count patch
mythwebcount.patch (2.5 KB ) - added by daraden 7 years ago.
fixed typo in mythwebcount.patch

Download all attachments as: .zip

Change History (12)

by daraden, 7 years ago

Attachment: mythcount.patch added

mythtv php bindings count patch

comment:1 by Peter Bennett, 7 years ago

See also #13324, #13290

comment:2 by Stuart Auchterlonie, 7 years ago

Milestone: needs_triage30.1
Status: newaccepted

Needs backporting to fixes/29 and fixes/30

comment:3 by hobbes1069, 7 years ago

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 by hobbes1069, 7 years ago

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

by daraden, 7 years ago

Attachment: mythwebcount.patch added

fixed typo in mythwebcount.patch

comment:5 by daraden, 7 years ago

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.

comment:6 by jr3us, 7 years ago

Per the following thread in the forum ( https://forum.mythtv.org/viewtopic.php?p=13823#p13823 ) the count error also affects the file Mythbackend.php as follows:

Warning at /usr/share/mythtv/bindings/php/MythBackend.php, line 194: NoTrans: count(): Parameter must be an array or an object that implements Countable!!

Last edited 7 years ago by jr3us (previous) (diff)

comment:7 by Richard Shaw <hobbes1069@…>, 7 years ago

In c04a650ee/mythweb:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:8 by David Hampton <mythtv@…>, 7 years ago

In 7e2e51d1d/mythweb:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:9 by David Hampton <mythtv@…>, 7 years ago

Resolution: fixed
Status: acceptedclosed

In dc87fada5/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available

comment:10 by David Hampton <mythtv@…>, 6 years ago

In 7a8752dc0f/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available
Note: See TracTickets for help on using tickets.