Opened 21 months ago

Closed 20 months ago

Last modified 20 months ago

#13260 closed Patch - Bug Fix (Fixed)

Mythweb throws php warning on 'recorded programmes' screen under php7.2

Reported by: george.poulson@… Owned by: Stuart Auchterlonie
Priority: minor Milestone: 29.2
Component: Plugin - MythWeb Version: v29-fixes
Severity: low Keywords:
Cc: Ticket locked: no

Description

MythTV version 29-fixes on lubuntu 18.04 (php version 7.2)

The 'recorded programmes' screen of mythweb reports two php warnings at the top of the screen. All of the content below displays correctly.

The text of the errors is:

Warning at /usr/share/mythtv/mythweb/modules/tv/recorded.php, line 188:
!!NoTrans: Use of undefined constant disk_size - assumed 'disk_size' (this will throw an Error in a future version of PHP)!!

Warning at /usr/share/mythtv/mythweb/modules/tv/recorded.php, line 189:
!!NoTrans: Use of undefined constant disk_used - assumed 'disk_used' (this will throw an Error in a future version of PHP)!!

The fix is to add single quotes around the terms 'disk_size' and 'disk used'

george@tvbox:/usr/share/mythtv/mythweb/modules/tv$ diff recorded.php recorded.php~
188,189c188,189
<         define(disk_size, ($size * 1024));
<         define(disk_used, ($used * 1024));
---
>         define('disk_size', ($size * 1024));
>         define('disk_used', ($used * 1024));

I have only seen this on the latest [l]ubuntu release with php7.2. Earlier releases are fine.

george@tvbox:~$ php --version PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies

Change History (4)

comment:1 in reply to:  description Changed 21 months ago by Gary Buhrmaster

FWIW, there is also a define of those variables a few lines previously which would be invoked if one has php-gmp available.

So I believe (untested) the more complete fix would be:

diff --git a/modules/tv/recorded.php b/modules/tv/recorded.php
index 70c04359..d374c034 100644
--- a/modules/tv/recorded.php
+++ b/modules/tv/recorded.php
@@ -179,14 +179,14 @@
     if (function_exists('gmp_mul')) {
     // GMP functions should work better with 64 bit numbers.
         $size = gmp_mul('1024', $size);
-        define(disk_size, gmp_strval($size));
+        define('disk_size', gmp_strval($size));
         $size = gmp_mul('1024', $used);
-        define(disk_used, gmp_strval($size));
+        define('disk_used', gmp_strval($size));
     }
     else {
     // This is inaccurate, but it's the best we can get without GMP.
-        define(disk_size, ($size * 1024));
-        define(disk_used, ($used * 1024));
+        define('disk_size', ($size * 1024));
+        define('disk_used', ($used * 1024));
     }
 
 // Load the class for this page

comment:2 Changed 20 months ago by Britney Fransen

I can confirm that Gary's patch does remove the warning under php 7.3.

comment:3 Changed 20 months ago by Bill Meek

Resolution: Fixed
Status: newclosed

master: 664dc1707ccf7be8b0b1d9eadf6366de8bbaa9c9/mythweb

v29/fixes: 6a6eb1a4a9e48a3f7fcf3006cb4404051e572911/mythweb

Same fix as above, I just didn't look for the ticket 1st. Both fixes exist, not sure why changeset isn't linking to them.

Last edited 20 months ago by Bill Meek (previous) (diff)

comment:4 Changed 20 months ago by Stuart Auchterlonie

Milestone: needs_triage29.2
Note: See TracTickets for help on using tickets.