View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012759 | mantisbt | plug-ins | public | 2011-02-10 08:50 | 2014-09-23 18:05 |
| Reporter | sveyret | Assigned To | dregad | ||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.2.4 | ||||
| Target Version | 1.2.7 | Fixed in Version | 1.2.7 | ||
| Summary | 0012759: Error loading language string when plugin is not current | ||||
| Description | If plugin_lang_get is called from a plugin with the optional $p_basename parameter, the function will build the full string name accordingly, then call lang_get. | ||||
| Steps To Reproduce |
| ||||
| Tags | patch | ||||
| Attached Files | plugin_lang_get.patch (1,232 bytes)
From 63a288c1010754852473d448703304d36a30854a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=82phane=20Veyret?= <sveyret@axway.com>
Date: Thu, 10 Feb 2011 14:58:57 +0100
Subject: [PATCH] 12759: Error loading language string when plugin is not current
---
core/plugin_api.php | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/core/plugin_api.php b/core/plugin_api.php
index e4188f8..cdeaae0 100644
--- a/core/plugin_api.php
+++ b/core/plugin_api.php
@@ -228,15 +228,18 @@ function plugin_config_defaults( $p_options ) {
* @return string Language string
*/
function plugin_lang_get( $p_name, $p_basename = null ) {
- if( is_null( $p_basename ) ) {
- $t_basename = plugin_get_current();
- } else {
- $t_basename = $p_basename;
+ if( !is_null( $p_basename ) ) {
+ plugin_push_current( $p_basename );
}
+ $t_basename = plugin_get_current();
$t_name = 'plugin_' . $t_basename . '_' . $p_name;
+ $t_string = lang_get( $t_name );
- return lang_get( $t_name );
+ if( !is_null( $p_basename ) ) {
+ plugin_pop_current();
+ }
+ return $t_string;
}
function plugin_history_log( $p_bug_id, $p_field_name, $p_old_value, $p_new_value = '', $p_user_id = null, $p_basename = null ) {
--
1.7.1
| ||||
|
Added a patch built against branch master-1.2.x which push/pop the plug-in if basename is given while getting the string. |
|
|
Hi Stéphane, I just committed your patch, thanks for your contribution ! As a side and unrelated note, I got the following warning while applying it: $ git am -s /tmp/plugin_lang_get.patch And then in the git log your name shows up like this: I edited the patch file to put the "é" and then everything was fine. Not sure what is causing this, if it's on your end or mine. |
|
|
Oh, and one more thing: in your commit message, when referencing a bug on the tracker, please make sure to prepend a "#" before the bug ID, this way the commit gets picked up automatically by source control plugin Something like Fix #00000 |
|
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
|
MantisBT: master-1.2.x 4c9eb5a2 2011-02-10 00:58 Details Diff |
12759: Error loading language string when plugin is not current Signed-off-by: Damien Regad <damien.regad@merckgroup.com> |
Affected Issues 0012759 |
|
| mod - core/plugin_api.php | Diff File | ||
|
MantisBT: master 9dda347b 2011-02-10 00:58 Details Diff |
12759: Error loading language string when plugin is not current Signed-off-by: Damien Regad <damien.regad@merckgroup.com> |
Affected Issues 0012759 |
|
| mod - core/plugin_api.php | Diff File | ||