From 27502918fb55e117a01114e794644772eda36274 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 24 Jan 2012 08:58:21 -0600 Subject: [PATCH] fix bundle dependency error possibility. fix WSOD in view rendering. --- laravel/bundle.php | 6 ++---- laravel/response.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index 20c7bb6a..5cf8c25b 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -46,7 +46,7 @@ public static function start($bundle) // dependent bundles so that they are available. if (file_exists($path = static::path($bundle).'bundle'.EXT)) { - require $path; + require_once $path; } // Each bundle may also have a "routes" file which is responsible for @@ -65,11 +65,9 @@ public static function start($bundle) */ public static function routes($bundle) { - if (static::started($bundle)) return; - if (file_exists($path = static::path($bundle).'routes'.EXT)) { - require $path; + require_once $path; } } diff --git a/laravel/response.php b/laravel/response.php index a51c094c..ba647bee 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -214,7 +214,16 @@ public static function prepare($response) // Since this method is used by both the Route and Controller classes, it is // a convenient spot to cast the application response to a string before it // is returned to the main request handler. - $response->content = (string) $response->content; + $content =& $response->content; + + if (is_object($content) and method_exists($content, '__toString')) + { + $content = $content->__toString(); + } + else + { + $content = (string) $content; + } return $response; }