diff --git a/ChangeLog b/ChangeLog
index 0e24330951..8469829b63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ phpMyAdmin - ChangeLog
- bug #4336 List server css style wrong
- bug #4345 Privileges editor shows databases with underscore backslash-escaped
- bug Missing value on the Status > Server page
+- bug #4347 Fixed PHP Parse error in Advisor
4.1.12.0 (2014-03-27)
- bug #4334 Add event : datepicker won't open
diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php
index 0512927549..f905d4c037 100644
--- a/libraries/Advisor.class.php
+++ b/libraries/Advisor.class.php
@@ -176,9 +176,11 @@ class Advisor
{
$string = _gettext(Advisor::escapePercent($str));
if ( ! is_null($param)) {
- $param = $this->ruleExprEvaluate($param);
+ $params = $this->ruleExprEvaluate('array('. $param . ')');
+ } else {
+ $params = array();
}
- return sprintf($string, $param);
+ return vsprintf($string, $params);
}
/**
diff --git a/test/classes/PMA_Advisor_test.php b/test/classes/PMA_Advisor_test.php
index a13c68c698..8558da8c8d 100644
--- a/test/classes/PMA_Advisor_test.php
+++ b/test/classes/PMA_Advisor_test.php
@@ -210,6 +210,22 @@ class Advisor_Test extends PHPUnit_Framework_TestCase
),
null,
),
+ array(
+ array(
+ 'justification' => '%s% %d foo | value, value',
+ 'name' => 'Double',
+ 'issue' => 'issue',
+ 'recommendation' => 'Recommend'
+ ),
+ array(
+ 'justification' => '0% 0 foo',
+ 'id' => 'Double',
+ 'name' => 'Double',
+ 'issue' => 'issue',
+ 'recommendation' => 'Recommend'
+ ),
+ null,
+ ),
array(
array(
'justification' => '"\'foo',
@@ -236,7 +252,7 @@ class Advisor_Test extends PHPUnit_Framework_TestCase
array(),
'Failed formatting string for rule \'Failure\'. PHP threw ' .
'following error: Use of undefined constant fsafdsa - ' .
- 'assumed \'fsafdsa\'
Executed code: $value = fsafdsa;',
+ 'assumed \'fsafdsa\'
Executed code: $value = array(fsafdsa);',
),
array(
array(