2016-04-14 18 views
6

Próbowałem uruchomić aktualizację instalatora i kompozytor jak zwykle przed rozpoczęciem pracy z projektem Laravel. Jednak spotkałem się z dziwnym problemem, którego nie potrafię rozwiązać od dłuższego czasu.Laravel 4.2 - wydanie aktualizacji dla kompozytora

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            

Po googlowania ten problem, próbowałem następujących rozwiązań, ale żaden z nich nie pracował:

  1. usuwania vendor folder i composer.lock a następnie uruchomiony composer install
  2. usuwania bootstrap/compiled.php a następnie uruchomiony composer update
  3. z systemem php artisan cache:clear lub php artisan views:clear, aby opróżnić katalog storage/views. php artisan również nie działa
  4. Próbowałem usunięcie storage/views ręcznie, ale to również nie
  5. aktualizacji kompozytor --no-skrypty.

Zmieniłem uprawnienia folderu na 777 na wypadek, gdyby był to problem z uprawnieniami, ale także nie powiodło się.

Tutaj jest composer.json na wszelki wypadek:

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

więc trzymałem śledzenie błędu I był już od storage/views go znaleźć w pierwszym foreach pętli:

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

Dodając do tego funkcję url poprzedzają _, o ile pamiętam, Laravel 4.2 nie było, wystarczy napisać: url('url here'). Również ten sam problem występuje pod numerami en i ar. Pierwsza pętla foreach zawiera stwierdzenie: Invalid argument supplied for foreach, co jest dziwne, ponieważ nie mogę użyć php artisan do migracji bazy danych, a nawet do jej zainicjowania.

Co dziwniejsze, ten sam kod jest obecnie dostępny i działa normalnie.

Każdy pomysł, co może być problemem ?!

+0

Czy próbowałeś ręcznie usunąć wszystko w aplikacji/pamięci/widokach? – aynber

+0

@aynber tak zrobiłem – omarsafwany

+0

Jeśli otworzysz projekt w swoim IDE, czy widzisz coś podkreślonego jak błąd w stosie folderów projektu? – Norgul

Odpowiedz

0

Chociaż jest to dziwne, ale znalazłem błąd. Wersja host w konfiguracji bazy danych została ustawiona na localhost i z jakiegoś nieznanego powodu nie działała i podając powyższe błędy. Zmieniłem go na 127.0.0.1 i działało normalnie.

Nie mogę znaleźć prawdziwego powodu, ponieważ w śledzeniu błędu nie ma nic związanego z tą częścią.

0

czy wypróbowałeś/zaktualizowałeś sudo composer? Miałem już podobne problemy i naprawiłem je za pomocą sudo

+0

Zawsze uruchamiam polecenie używając sudo, więc do tej pory nie działa – omarsafwany

Powiązane problemy