[Solved] Mythweb PHP 7.4 Errors

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
TMonster
Junior
Posts: 20
Joined: Fri Jan 05, 2018 6:15 pm
Great Britain

[Solved] Mythweb PHP 7.4 Errors

Post 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?
hamelg
Newcomer
Posts: 10
Joined: Fri Jan 03, 2020 8:57 pm
France

Re: Mythweb PHP 7.4 Errors

Post 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);
TMonster
Junior
Posts: 20
Joined: Fri Jan 05, 2018 6:15 pm
Great Britain

Re: Mythweb PHP 7.4 Errors

Post 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?
TMonster
Junior
Posts: 20
Joined: Fri Jan 05, 2018 6:15 pm
Great Britain

Re: Mythweb PHP 7.4 Errors

Post by TMonster »

Ticket created:#13572
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Mythweb PHP 7.4 Errors

Post by bill6502 »

Pushed commit to v31 and v30. Thanks @hamelg and @TMonster.
Post Reply