2016-04-14 24 views
6

Tôi đã cố chạy bản cập nhật trình soạn nhạc và cài đặt soạn nhạc như bình thường trước khi làm việc với dự án Laravel. Tuy nhiên tôi gặp phải một vấn đề kỳ lạ mà tôi dường như không thể giải quyết được một thời gian.Laravel 4.2 - vấn đề cập nhật về soạn nhạc

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            

Sau khi googling vấn đề này, tôi đã thử các giải pháp sau đây nhưng không ai trong số họ làm việc:

  1. loại bỏ vendor thư mục và composer.lock và sau đó chạy composer install
  2. loại bỏ bootstrap/compiled.php và sau đó chạy composer update
  3. chạy php artisan cache:clear hoặc php artisan views:clear để trống thư mục storage/views. php artisan cũng không hoạt động
  4. Tôi đã thử xóa storage/views theo cách thủ công nhưng cũng không thành công
  5. cập nhật trình soạn nhạc - không có tập lệnh.

Tôi đã thay đổi quyền của thư mục thành 777 chỉ trong trường hợp đó là vấn đề về quyền nhưng cũng không thành công.

Dưới đây là composer.json chỉ trong trường hợp:

{ 
    "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:

vì vậy tôi giữ truy tìm các lỗi tôi đã nhận được từ storage/views để tìm thấy nó trong foreach vòng đầu tiên:

<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> 

Thêm vào đó tôi tìm thấy hàm url trước sau _ mà theo như tôi nhớ Laravel 4.2 không có ở đó, bạn chỉ cần viết url('url here'). Ngoài ra, enar cũng làm theo cùng một vấn đề. Vòng lặp foreach đầu tiên tiếp tục ghi rõ Invalid argument supplied for foreach, điều này thật lạ vì tôi không thể sử dụng php artisan để di chuyển cơ sở dữ liệu hoặc thậm chí là gieo hạt.

Điều kỳ lạ hơn là cùng một mã hiện đang hoạt động và hoạt động bình thường.

Bất kỳ ý tưởng nào có thể là vấn đề ở đây ?!

+0

Bạn đã thử xóa thủ công mọi thứ trong ứng dụng/bộ nhớ/chế độ xem? – aynber

+0

@aynber vâng tôi đã làm – omarsafwany

+0

Nếu bạn mở một dự án trong IDE của mình, bạn có thấy điều gì đó được gạch chân như một lỗi trong ngăn xếp thư mục dự án không? – Norgul

Trả lời

0

Mặc dù điều này thật lạ, nhưng tôi đã phát hiện lỗi. Các host trong cấu hình cơ sở dữ liệu đã được thiết lập để localhost và vì một lý do không rõ nó không hoạt động và đưa ra các lỗi đã nêu ở trên. Tôi đã đổi nó thành 127.0.0.1 và nó hoạt động bình thường.

Tôi không thể tìm ra lý do thực sự vì không có gì liên quan đến phần này trong dấu vết lỗi.

0

bạn đã thử cài đặt/cập nhật trình soạn thảo sudo chưa? Tôi có các vấn đề tương tự ngày hôm nay và đã khắc phục sự cố đó với sudo

+0

Tôi luôn chạy lệnh bằng sudo cho đến bây giờ nó không hoạt động – omarsafwany

Các vấn đề liên quan