2016-04-14 8 views
6

私は、Laravelプロジェクトを扱う前に、作曲家のインストールと作曲家のアップデートをいつものように実行しようとしました。しかし私は奇妙な問題に遭遇しました。私はかなりの間解決できないようです。Laravel 4.2 - 作曲家の更新の問題

PHP Fatal error: Uncaught exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7:35 
Stack trace: 
#0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleError(2, 'Invalid argumen...', '/Applications/X...', 35, Array) 
#1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications/X...') 
#2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\Engines\PhpEngine->evaluatePath('/Applications/X...', Array) 
#3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEngine->get('/Applications/X...', Array) 
#4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 on line 35 
PHP Fatal error: Uncaught exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7:35 
Stack trace: 
#0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleError(2, 'Invalid argumen...', '/Applications/X...', 35, Array) 
#1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications/X...') 
#2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\Engines\PhpEngine->evaluatePath('/Applications/X...', Array) 
#3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEngine->get('/Applications/X...', Array) 
#4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 on line 35 
Script php artisan clear-compiled handling the post-update-cmd event returned with an error 


    [RuntimeException]               
    Error Output: PHP Fatal error: Uncaught exception 'ErrorException' with me 
    ssage 'Invalid argument supplied for foreach()' in /Applications/XAMPP/xamp 
    pfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de 
    3dc7:35                  
    Stack trace:                 
    #0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d 
    4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleEr 
    ror(2, 'Invalid argumen...', '/Applications/X...', 35, Array)     
    #1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram 
    ework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications 
    /X...')                  
    #2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram 
    ework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\E 
    ngines\PhpEngine->evaluatePath('/Applications/X...', Array)     
    #3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram 
    ework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEn 
    gine->get('/Applications/X...', Array)          
    #4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles 
    /htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 o 
    n line 35                  
    PHP Fatal error: Uncaught exception 'ErrorException' with message 'Invalid 
    argument supplied for foreach()' in /Applications/XAMPP/xamppfiles/htdocs/ 
    wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7:35   
    Stack trace:                 
    #0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d 
    4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleEr 
    ror(2, 'Invalid argumen...', '/Applications/X...', 35, Array)     
    #1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram 
    ework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications 
    /X...')                  
    #2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram 
    ework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\E 
    ngines\PhpEngine->evaluatePath('/Applications/X...', Array)     
    #3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram 
    ework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEn 
    gine->get('/Applications/X...', Array)          
    #4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles 
    /htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 o 
    n line 35            

は、この問題をグーグルでの後、私は次の解決策を試してみましたが、それらのどれも働いた:

  1. vendorフォルダとcomposer.lockを削除してからbootstrap/compiled.phpを削除してからcomposer update
  2. を実行しているcomposer install
  3. を実行していますstorage/viewsディレクトリを空にするには、php artisan cache:clearまたはphp artisan views:clearを実行してください。 php artisanも動作しません
  4. 手動でstorage/viewsを削除しようとしましたが、失敗しました。また、失敗しました。
  5. composer update --no-scripts

許可の問題であっても失敗した場合は、フォルダのアクセス許可を777に変更しました。

はここcomposer.jsonは場合にだけです:

{ 
    "name": "laravel/laravel", 
    "description": "The Laravel Framework.", 
    "keywords": ["framework", "laravel"], 
    "license": "MIT", 
    "require": { 
     "laravel/framework": "4.2.7" 
    }, 
    "autoload": { 
     "classmap": [ 
      "app/commands", 
      "app/controllers", 
      "app/models", 
      "app/database/migrations", 
      "app/database/seeds", 
      "app/tests/TestCase.php" 
     ] 
    }, 
    "scripts": { 
     "post-install-cmd": [ 
      "php artisan clear-compiled", 
      "php artisan optimize" 
     ], 
     "post-update-cmd": [ 
      "php artisan clear-compiled", 
      "php artisan optimize" 
     ], 
     "post-create-project-cmd": [ 
      "php artisan key:generate" 
     ] 
    }, 
    "config": { 
     "preferred-install": "dist" 
    }, 
    "minimum-stability": "stable" 
} 

UPDATE:

ので、私は最初foreachループでそれを見つけるためにstorage/viewsからなっていたエラーをトレースまま:

<div class="sub-menu"> 
    @foreach($_destinationsList as $destination) 
     <ul> 
     <li> 
     <a href="{{_url('destination/'.$destination->slug)}}">{{$destination->{_en('name')._ar('name_ar')} }}</a> 
     </li> 
     @foreach($destination->children as $destination) 
     <li> 
     <a href="{{_url('destination/'.$destination->slug)}}">{{$destination->{_en('name')._ar('name_ar')} }}</a> 
     </li> 
     @endforeach 
     </ul> 
    @endforeach 
</div> 

これに加えて、urlの機能の前に_ Laravel 4.2が覚えていない限り、それはurl('url here')と書いてあります。 enarも同じ問題を抱えています。最初のforeachループはInvalid argument supplied for foreachと言っています。php artisanを使用してデータベースを移行したり、シードしたりすることはできません。

もっと奇妙なのは、同じコードが現在生きていて正常に動作していることです。

ここで何が問題になるのでしょうか?

+0

app/storage/viewsのすべてを手動で削除しようとしましたか? – aynber

+0

@aynberはい私は – omarsafwany

+0

IDEでプロジェクトを開くと、プロジェクトフォルダのスタックにエラーのような下線が表示されることがありますか? – Norgul

答えて

0

これは奇妙ですが、エラーが見つかりました。データベース構成のhostlocalhostに設定されていましたが、何らかの不明な理由により、上記のエラーが発生していませんでした。私は127.0.0.1に変更し、正常に動作しました。

エラートレースにはこの部分には何も関係していないので、本当の理由はわかりません。

0

あなたはsudo composerのインストール/アップデートを試しましたか?私は今日も同様の問題を抱えていて、sudoで修正しました

+0

私はいつもsudoを使ってコマンドを実行しています。 – omarsafwany

関連する問題