diff --git a/lib/task/sfTask.class.php b/lib/task/sfTask.class.php index e5d728490..79de3dde5 100644 --- a/lib/task/sfTask.class.php +++ b/lib/task/sfTask.class.php @@ -304,7 +304,10 @@ public function getBriefDescription() */ public function getDetailedDescription() { - return preg_replace('/\[(.+?)\|(\w+)\]/se', '$this->formatter->format("$1", "$2")', $this->detailedDescription); + $formatter = $this->getFormatter(); + return preg_replace_callback('/\[(.+?)\|(\w+)\]/s', function ($match) use ($formatter) { + return $formatter->format($match['1'], $match['2']); + }, $this->detailedDescription); } /** diff --git a/test/unit/task/sfTaskTest.php b/test/unit/task/sfTaskTest.php index 32edcead3..faa3115ce 100644 --- a/test/unit/task/sfTaskTest.php +++ b/test/unit/task/sfTaskTest.php @@ -9,7 +9,7 @@ */ require_once dirname(__FILE__).'/../../bootstrap/unit.php'; -$t = new lime_test(15); +$t = new lime_test(16); abstract class BaseTestTask extends sfTask { @@ -114,3 +114,19 @@ protected function configure() $task->run(array(), array('array' => 'one')); $t->is_deeply($task->lastOptions, array('none' => false, 'required' => null, 'optional' => null, 'array' => array('one')), '->run() accepts an associative array of options with a scalar array option value'); + +// ->getDetailedDescription() +$t->diag('->getDetailedDescription()'); + +class DetailedDescriptionTestTask extends BaseTestTask +{ + protected function configure() + { + $this->detailedDescription = <<is($task->getDetailedDescription(), "The detailedDescription formats special string like ... or --xml", "->getDetailedDescription() formats special string");