From ac3b2b8a8eda609707f59c2aa70d4f4edfd6065a Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 5 Aug 2013 10:03:27 -0400 Subject: [PATCH] Fixed PHP 5.3 compatibility issue. --- framework/yii/widgets/ListViewBase.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/yii/widgets/ListViewBase.php b/framework/yii/widgets/ListViewBase.php index 802718b..fe318c4 100644 --- a/framework/yii/widgets/ListViewBase.php +++ b/framework/yii/widgets/ListViewBase.php @@ -91,8 +91,9 @@ abstract class ListViewBase extends Widget public function run() { if ($this->dataProvider->getCount() > 0 || $this->empty === false) { - $content = preg_replace_callback("/{\\w+}/", function ($matches) { - $content = $this->renderSection($matches[0]); + $widget = $this; + $content = preg_replace_callback("/{\\w+}/", function ($matches) use ($widget) { + $content = $widget->renderSection($matches[0]); return $content === false ? $matches[0] : $content; }, $this->layout); } else { @@ -108,7 +109,7 @@ abstract class ListViewBase extends Widget * @param string $name the section name, e.g., `{summary}`, `{items}`. * @return string|boolean the rendering result of the section, or false if the named section is not supported. */ - protected function renderSection($name) + public function renderSection($name) { switch ($name) { case '{summary}':