View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0020864 | mantisbt | administration | public | 2016-04-30 08:18 | 2016-08-15 09:02 |
Reporter | dvzrv | Assigned To | dregad | ||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | nginx+uwsgi+mariadb+php7 | OS | Arch Linux | ||
Product Version | 1.2.19 | ||||
Target Version | 1.2.20 | Fixed in Version | 1.2.20 | ||
Summary | 0020864: "user_pref_get_language()" not defined | ||||
Description | As mentioned downstream (https://bugs.archlinux.org/task/49141) I ran into the issue of being unable to login with the administrator account after an initial setup of mantisbt, using nginx+uwsgi+mariadb+php7 on Arch Linux, hitting the bug mentioned under "Additional Information" | ||||
Steps To Reproduce | Install mantisbt using nginx+uwsgi+mariadb+php7 and the tarball from version 1.2.19. After completing the database install setup (/admin/install.php), try to login using the standard first admin user "administrator" with the password "root". | ||||
Additional Information | PHP Fatal error: Uncaught Error: Call to undefined function user_pref_get_language() in /usr/share/webapps/mantisbt/core/lang_api.php:104 | ||||
Tags | PHP 7 | ||||
Attached Files | lang_api.patch (408 bytes)
--- mantisbt-1.2.19/core/lang_api.php 2015-01-26 00:00:30.000000000 +0100 +++ mantisbt-1.2.19/core/lang_api.php.patch 2016-04-30 13:41:10.536906702 +0200 @@ -23,6 +23,11 @@ * @link http://www.mantisbt.org */ +/** + * requires user_pref_api + */ +require_once( 'user_pref_api.php' ); + # Cache of localization strings in the language specified by the last # lang_load call $g_lang_strings = array(); | ||||
I propose applying the attached patch. As I don't know the codebase, this could be horribly wrong, though. ;-) |
|
Hello, Although your proposed patch could fix the problem (I didn't test it), looking at your call stack, I don't think it addresses the root cause: 1 /usr/share/webapps/mantisbt/core/string_api.php(33): error_handler(8192, 'Methods with th...', '/usr/share/weba...', 31, Array) That's an E_DEPRECATED warning, which is triggered exactly as user_pref_api.php is being included by string_api.php (line 33). You only provide a partial error message 'Methods with th...', but since you mentioned PHP7, I assume it is 'Methods with the same name as their class will not be constructors in a future version of PHP' , triggered by the UserPreferences class constructor (line 96 in user_pref_api.php). Can you please try renaming the method to __construct() and let me know if that fixes the issue ? |
|
For the record: I can confirm that the issue can be reproduced anytime an error is triggered prior to user_pref_api.php being successfully included in string_api.php. The proposed patch is therefore the correct way of fixing the reported issue. The problem with PHP4 constructors (as the cause for the error occuring in the first place) still needs to be addressed for PHP7 support. |
|
This was actually fixed in 0020501 |
|
@dregad: Renaming the UserPreferences function to __construct() (line 96 in core/user_pref_api.php) also fixes the problem! As for the patches (https://mantisbt.org/bugs/view.php?id=20501): When will these fixes find their way to a release tarball? |
|
MantisBT: master-1.2.x 672a256e 2016-04-30 07:25 Details Diff |
Require user pref API in lang API If the user pref API has not yet been loaded and an error is triggered, then the error API is not able to retrieve the error message because language API cannot get the user's preferred language. Fixes 0020864 |
Affected Issues 0020864 |
|
mod - core/lang_api.php | Diff File |