2013-10-08 97 views
1

我已经辞职自己升级到Laravel 4.1.x(composer.json类型的安装,对我来说,所以我更新了我的控制器别名,如安东尼奥卡洛斯里贝罗提到),但有现在不同的问题:Laravel - 类filter.parser不存在

编辑:最后我做一个全新的安装作为亚当河克隆后新Laravel回购后,和现在的工作(复制什么小公共文件,我不得不结束后)。

[2013-10-11 21:25:58] production.ERROR: exception 'ErrorException' with message 'Attempt to assign property of non-object' in /path/to/laravel/app/controllers/HomeController.php:22 
Stack trace: 
#0 /path/to/laravel/app/controllers/HomeController.php(22): Illuminate\Exception\Handler->handleError(2, 'Attempt to assi...', '/path/to/laravel...', 22, Array) 
#1 [internal function]: HomeController->Index() 
#2 /path/to/laravel/bootstrap/compiled.php(5574): call_user_func_array(Array, Array) 
#3 /path/to/laravel/bootstrap/compiled.php(5562): Illuminate\Routing\ControllerDispatcher->call(Object(HomeController), Object(Illuminate\Routing\Route), 'Index') 
#4 /path/to/laravel/bootstrap/compiled.php(4901): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'HomeController', 'Index') 
#5 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}() 
#6 /path/to/laravel/bootstrap/compiled.php(5155): call_user_func_array(Object(Closure), Array) 
#7 /path/to/laravel/bootstrap/compiled.php(4925): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) 
#8 /path/to/laravel/bootstrap/compiled.php(4914): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) 
#9 /path/to/laravel/bootstrap/compiled.php(548): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) 
#10 /path/to/laravel/bootstrap/compiled.php(532): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) 
#11 /path/to/laravel/public/index.php(49): Illuminate\Foundation\Application->run() 
#12 {main} [] [] 

,其中的代码是:

<?php 

class HomeController extends BaseController { 

    /* 
    |-------------------------------------------------------------------------- 
    | Default Home Controller 
    |-------------------------------------------------------------------------- 
    | 
    | You may wish to use controllers instead of, or in addition to, Closure 
    | based routes. That's great! Here is an example controller method to 
    | get you started. To route to this controller, just add the route: 
    | 
    | Route::get('/', '[email protected]'); 
    | 
    */ 

    protected $layout = 'layouts.master'; 

    public function Index() 
    { 
     $this->layout->content = View::make('home'); //This is line 22 
    } 

} 

BaseController

<?php 

class BaseController extends Controller { 

     /** 
     * Setup the layout used by the controller. 
     * 
     * @return void 
     */ 
     protected function setupLayout() 
     { 
       if (! is_null($this->layout)) 
       { 
         $this->layout = View::make($this->layout); 
       } 
     } 

} 

routes.php

<?php 

/* 
|-------------------------------------------------------------------------- 
| Application Routes 
|-------------------------------------------------------------------------- 
| 
| Here is where you can register all of the routes for an application. 
| It's a breeze. Simply tell Laravel the URIs it should respond to 
| and give it the Closure to execute when that URI is requested. 
| 
*/ 

Route::get('/', '[email protected]'); 

老问题:

我一直在使用WAMP上的Laravel 4.0.x,并打算将我的站点部署到我的LEMP堆栈。不过,我一直遇到这样的错误:

[2013-10-09 01:20:00] log.ERROR: exception 'ReflectionException' with message 'Class filter.parser does not exist' in /path/to/laravel/bootstrap/compiled.php:165 
Stack trace: 
#0 /path/to/laravel/bootstrap/compiled.php(165): ReflectionClass->__construct('filter.parser') 
#1 /path/to/laravel/bootstrap/compiled.php(142): Illuminate\Container\Container->build('filter.parser', Array) 
#2 /path/to/laravel/bootstrap/compiled.php(442): Illuminate\Container\Container->make('filter.parser', Array) 
#3 /path/to/laravel/bootstrap/compiled.php(233): Illuminate\Foundation\Application->make('filter.parser') 
#4 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(104): Illuminate\Container\Container->offsetGet('filter.parser') 
#5 /path/to/laravel/bootstrap/compiled.php(4755): Illuminate\Routing\Controllers\Controller->callAction(Object(Illuminate\Foundation\Application), Object(Illuminate\Routing\Router), 'Index', Array) 
#6 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}() 
#7 /path/to/laravel/bootstrap/compiled.php(7824): call_user_func_array(Object(Closure), Array) 
#8 /path/to/laravel/bootstrap/compiled.php(7811): Illuminate\Routing\Route->callCallable() 
#9 /path/to/laravel/bootstrap/compiled.php(4766): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) 
#10 /path/to/laravel/bootstrap/compiled.php(481): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) 
#11 /path/to/laravel/bootstrap/compiled.php(470): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) 
#12 /path/to/laravel/public/index.php(49): Illuminate\Foundation\Application->run() 
#13 {main} [] [] 

当我删除我的路线基本上是

Route::get('/', '[email protected]'); 

错误消息变为未却发现。不知道这是否意味着什么,但我认为错误信息与路由有关。

我能想到的是作曲家包的唯一的区别(我甚至尝试直接复制的vendor文件夹)或者PHP版本(5.4.12上WAMP,5.4.19上LEMP)。

我尝试了Google类的名称,但我只发现了一个封闭的github问题的结果。任何人都可以帮我找出有什么问题吗?

仅供参考,我使用Laravel的版本在GitHub上相同的主分支 - https://github.com/laravel/laravel

我的更新错误删除我要做出/path/to/laravel/bootstrap/compiled.php

[2013-10-11 20:12:38] log.ERROR: exception 'ReflectionException' with message 'Class filter.parser does not exist' in /path/to/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:296 
Stack trace: 
#0 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(296): ReflectionClass->__construct('filter.parser') 
#1 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(238): Illuminate\Container\Container->build('filter.parser', Array) 
#2 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(425): Illuminate\Container\Container->make('filter.parser', Array) 
#3 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(468): Illuminate\Foundation\Application->make('filter.parser') 
#4 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Routing/Controllers/Controller.php(104): Illuminate\Container\Container->offsetGet('filter.parser') 
#5 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(985): Illuminate\Routing\Controllers\Controller->callAction(Object(Illuminate\Foundation\Application), Object(Illuminate\Routing\Router), 'Index', Array) 
#6 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}() 
#7 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(80): call_user_func_array(Object(Closure), Array) 
#8 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(47): Illuminate\Routing\Route->callCallable() 
#9 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1016): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) 
#10 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(522): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) 
#11 /path/to/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(497): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) 
#12 /path/to/laravel/public/index.php(49): Illuminate\Foundation\Application->run() 
#13 {main} [] [] 

表观显着的变化后,我Laravel安装:

结束时app/start/global.php

-require app_path().'/filters.php'; 
+require app_path().'/filters.php'; 
+ 
+ClassLoader::register(new ClassLoader(array(
+ app_path().'/libraries', 
+))); 
+ 
+App::bind('html', function() { 
+ return new HTML; 
+}); 
+0

删除你的文件/path/to/laravel/bootstrap/compiled.php,再试一次,并与替换当前的错误信息新的,请。 –

+0

@AntonioCarlosRibeiro完成,该文件的目的只是为了充当缓存? – xiankai

+0

@xiankai是的,它只是用作缓存 –

回答

3

你的新的问题:

它看起来像有一个关于你的基地控制器出现问题。确保你的基本控制器看起来像这样:

<?php 

class BaseController extends Controller 
{ 
    /** 
    * Setup the layout used by the controller. 
    * 
    * @return void 
    */ 
    protected function setupLayout() 
    { 
     if (! is_null($this->layout)) 
     { 
      $this->layout = View::make($this->layout); 
     } 
    } 
} 
+0

我用'app/config/app.php'替换了配置文件,但是生成的diff实际上显示删除了一行 - “Illuminate \ Remote \ RemoteServiceProvider”,并且列表中的那些已经所有在那里。 – xiankai

+0

已更新的答案。 –

+0

没有运气,这是一个相对新鲜的Laravel安装,只有最低限度的配置。 'composer dump-autoload'给出了一个消息'生成autoload文件'但没有改变。 – xiankai

1

删除bootstrap/compiled.php文件。这应该可以帮助。

+0

我已更新我的问题以反映新的错误消息。 – xiankai

2

你是否从4.1回到4.0?

您可能需要检查你的应用程序/配置/ app.php此服务提供商:

'Illuminate\Routing\ControllerServiceProvider', 

它可能不是没有,正如亚当里弗斯说。

还要检查你的别名:

4.0

'Controller'  => 'Illuminate\Routing\Controllers\Controller', 

为4.1

'Controller'  => 'Illuminate\Routing\Controller', 

编辑:

关于你的新的问题,请检查您BaseController,至少看起来是这样的:

<?php 

class BaseController extends Controller { 

    /** 
    * Setup the layout used by the controller. 
    * 
    * @return void 
    */ 
    protected function setupLayout() 
    { 
     if (! is_null($this->layout)) 
     { 
      $this->layout = View::make($this->layout); 
     } 
    } 

} 
+0

我没有回滚到“4.0”(由于它取消了对控制器路由的支持),并且我的条目别名是'4.0'的别名。我试图改变它,但在/ path/to/laravel/vendor/laravel /中找到了'ErrorException'消息'Class'Illuminate \ Routing \ Controller'not found' framework/src/Illuminate/Foundation/AliasLoader.php:64'来代替。 – xiankai

+0

编辑猜测你的新问题。看起来像'setupLayout()'没有被调用。 –

+0

不幸的是'BaseController'看起来和你粘贴的一模一样 - 我没有修改它。不过,我已经添加了完整的堆栈跟踪。调试Laravel是如此痛苦。 – xiankai