Page 1 of 1

[Solved] Mythweb PHP 7.4 Errors

Posted: Tue Jan 14, 2020 8:55 am
by TMonster
Combined frontend / backend running on Arch Linux

After upgrading PHP to 7.4, Mythweb is showing an error several times when looking at the TV Listings (/mythweb/tv/list)

Code: Select all

Warning at /var/lib/mythtv/mythweb/modules/tv/includes/programs.php, line 204:
!!NoTrans: Creating default object from empty value!!
Which is this section:

Code: Select all

        // Add this program to the channel hash, etc.
            $these_programs[]                          =& $program;
            $channel_hash[$data['chanid']]->programs[] =& $program;
(Line 204 is channel_hash)

Downgrading the packages php & php-apache back to 7.3.12 resolves this problem, so this appears to be due to the PHP upgrade.

I don't know PHP well enough to determine the resolution - and my internet searches haven't helped (I've tried hacking the code, but it's just random guessing :) )

Does anyone have a solution for this?

Re: Mythweb PHP 7.4 Errors

Posted: Tue Jan 14, 2020 8:04 pm
by hamelg
I applied this patch to fix this error.

Code: Select all

--- programs.php.ori    2019-12-11 22:16:57.423529528 +0100
+++ programs.php        2019-12-11 22:55:37.649127471 +0100
@@ -201,6 +201,11 @@
             }
         // Add this program to the channel hash, etc.
             $these_programs[]                          =& $program;
+
+            // Creating default object from empty value php warning
+            $channel_hash[$data['chanid']] = new stdClass();
+            
             $channel_hash[$data['chanid']]->programs[] =& $program;
         // Cleanup
             unset($program);

Re: Mythweb PHP 7.4 Errors

Posted: Tue Jan 14, 2020 8:57 pm
by TMonster
Thanks @hamelg

That now works perfectly!

Did you want to raise a ticket on the MythTV bug reporting site to get this fixed for everyone https://code.mythtv.org/trac/ - or shall I?

Re: Mythweb PHP 7.4 Errors

Posted: Mon Feb 03, 2020 8:31 am
by TMonster
Ticket created:#13572

Re: Mythweb PHP 7.4 Errors

Posted: Mon Feb 03, 2020 5:27 pm
by bill6502
Pushed commit to v31 and v30. Thanks @hamelg and @TMonster.