diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index 4d8fd4050..77228fef6 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -516,7 +516,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { protected function _assertAttributes($assertions, $string) { $asserts = $assertions['attrs']; $explains = $assertions['explains']; - while (count($asserts) > 0) { + $len = count($asserts); + do { $matches = false; foreach ($asserts as $j => $assert) { if (preg_match(sprintf('/^%s/s', $assert), $string, $match)) { @@ -530,7 +531,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { if ($matches === false) { $this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]); } - } + $len = count($asserts); + } while ($len > 0); return $string; } diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 6ce3cfafa..d26ba64f3 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -713,14 +713,15 @@ class HtmlHelper extends AppHelper { * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper */ public function getCrumbList($options = array(), $startText = false) { - $defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => ''); + $defaults = array('firstClass' => 'first', 'lastClass' => 'last', 'separator' => '', 'escape' => true); $options = array_merge($defaults, (array)$options); $firstClass = $options['firstClass']; $lastClass = $options['lastClass']; $separator = $options['separator']; - unset($options['firstClass'], $options['lastClass'], $options['separator']); + $escape = $options['escape']; + unset($options['firstClass'], $options['lastClass'], $options['separator'], $options['escape']); - $crumbs = $this->_prepareCrumbs($startText); + $crumbs = $this->_prepareCrumbs($startText, $escape); if (empty($crumbs)) { return null; } @@ -752,9 +753,10 @@ class HtmlHelper extends AppHelper { * Prepends startText to crumbs array if set * * @param string $startText Text to prepend + * @param boolean $escape If the output should be escaped or not * @return array Crumb list including startText (if provided) */ - protected function _prepareCrumbs($startText) { + protected function _prepareCrumbs($startText, $escape = true) { $crumbs = $this->_crumbs; if ($startText) { if (!is_array($startText)) { @@ -766,7 +768,7 @@ class HtmlHelper extends AppHelper { $startText += array('url' => '/', 'text' => __d('cake', 'Home')); list($url, $text) = array($startText['url'], $startText['text']); unset($startText['url'], $startText['text']); - array_unshift($crumbs, array($text, $url, $startText)); + array_unshift($crumbs, array($text, $url, $startText + array('escape' => $escape))); } return $crumbs; }