From 2355c764a86c5e58c68133de00c4dc15d63d928e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 12 Dec 2013 18:39:40 +0100 Subject: [PATCH] Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle --- framework/CHANGELOG.md | 1 + framework/yii/web/View.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 53067a2..8ca5573 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -5,6 +5,7 @@ Yii Framework 2 Change Log ---------------------------- - Bug #1446: Logging while logs are processed causes infinite loop (qiangxue) +- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark) - Enh #1293: Replaced Console::showProgress() with a better approach. See Console::startProgress() for details (cebe) - Enh #1406: DB Schema support for Oracle Database (p0larbeer, qiangxue) - Enh #1437: Added ListView::viewParams (qiangxue) diff --git a/framework/yii/web/View.php b/framework/yii/web/View.php index db0c500..790e4fd 100644 --- a/framework/yii/web/View.php +++ b/framework/yii/web/View.php @@ -184,10 +184,12 @@ class View extends \yii\base\View return; } $bundle = $this->assetBundles[$name]; - foreach ($bundle->depends as $dep) { - $this->registerAssetFiles($dep); + if ($bundle) { + foreach ($bundle->depends as $dep) { + $this->registerAssetFiles($dep); + } + $bundle->registerAssetFiles($this); } - $bundle->registerAssetFiles($this); unset($this->assetBundles[$name]); }