Opened 12 years ago
Closed 11 years ago
#11513 closed Bug Report - General (Fixed)
MythWeb fails to load translations with php5.5
Reported by: | 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 12 years ago by
comment:3 Changed 12 years ago by
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
Milestone: | unknown → 0.27 |
---|---|
Owner: | set to Nicolas Riendeau |
Status: | new → assigned |
comment:7 Changed 11 years ago by
Resolution: | → Fixed |
---|---|
Status: | assigned → closed |
could you paste your fix somewhere by any chance?