Opened 11 years ago

Closed 11 years ago

#11513 closed Bug Report - General (Fixed)

MythWeb fails to load translations with php5.5

Reported by: scott.shawcroft@… Owned by: Nicolas Riendeau
Priority: minor Milestone: 0.27
Component: MythTV - General Version: 0.26
Severity: medium Keywords:
Cc: Ticket locked: no

Description

MythWeb fails to load translation files with php5.5 because module_path isn't set when Translate is constructed by error_handler to handle the error message generated by calling mysql_connect. To fix this I moved the error_reporting check above Translate::find. define and translate should probably be init earlier if error reporting depends on them.

Change History (7)

comment:1 Changed 11 years ago by jason@…

could you paste your fix somewhere by any chance?

comment:2 Changed 11 years ago by scott.shawcroft@…

Sure. I'll do it this weekend.

comment:3 Changed 11 years ago by scott.shawcroft@…

Sorry it took me longer to get you a patch. Here it is:

--- mythplugins-0.26.0/mythweb/includes/errors.php      2012-08-28 10:22:44.000000000 -0700
+++ /var/www/mythweb/htdocs/includes/errors.php 2013-06-21 14:45:28.580966423 -0700
@@ -103,6 +103,9 @@
 /**/
     function error_handler($errno, $errstr, $errfile, $errline, $vars) {
         global $db;
+    // Leave early if we haven't requested reports from this kind of error
+        if (!($errno & error_reporting()))
+            return;
         if (class_exists('Translate'))
             $errstr = Translate::find()->string($errstr);
     // Try to auto-repair damaged SQL tables
@@ -113,9 +116,6 @@
             add_error('Regular Expression Error:  '.$match[1]);
             return;
         }
-    // Leave early if we haven't requested reports from this kind of error
-        if (!($errno & error_reporting()))
-            return;
     // Fatal errors should report considerably more detail
         if (in_array($errno, array(E_USER_ERROR, E_ERROR))) {
         // What type of error?

The bug is caused by attempting to translate an error message before the state needed to load the translate library is setup. The error is non-fatal anyway afaict so this causes it to exit earlier before doing the translation rather than after.

comment:4 Changed 11 years ago by Nicolas Riendeau

Milestone: unknown0.27
Owner: set to Nicolas Riendeau
Status: newassigned

comment:5 Changed 11 years ago by Scott Shawcroft <scott.shawcroft@…>

In 35edce50186c212aa25c2eb7545f604ad3ca9ed1/mythweb:

Fix the problem of MythWeb failing to load translations

Refs #11513

Signed-off-by: Nicolas Riendeau <nriendeau@…>

comment:6 Changed 11 years ago by Scott Shawcroft <scott.shawcroft@…>

In 7326d7ef70fb86037d9c30ca7e0762d0cb01b7ff/mythweb:

Fix the problem of MythWeb failing to load translations

Refs #11513

Signed-off-by: Nicolas Riendeau <nriendeau@…>

comment:7 Changed 11 years ago by Nicolas Riendeau

Resolution: Fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.