I tried to start the update and the composer linker, as usual, before working with the Laravel project. However, I ran into some strange problem that I canβt solve for a long time.
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 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/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 on line 35
After searching for this problem, I tried the following solutions, but none of them worked:
- removing the
vendor and composer.lock folders and then running composer install - uninstall
bootstrap/compiled.php and then run composer update - run
php artisan cache:clear or php artisan views:clear to free the storage/views directory. php artisan also doesn't work - I tried to remove
storage/views manually, but also failed - composer update - non-scripts.
I changed the folder resolution to 777 just in case this is a permission problem, but it also failed.
Here's the composer .json just in case:
{ "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:
so I continued to track the error I was getting from storage/views to find it in the first foreach :
<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>
Adding to this, I find the url function preceded by _ , which, as far as I remember, Laravel 4.2 was not there, you just write url('url here') . Also the en and ar tags follow the same issue. In the first foreach , Invalid argument supplied for foreach is indicated, which is strange since I cannot use php artisan to transfer the database or even its seed.
What is weirder is that the same code is currently working and working fine.
Any idea what could be the problem here ?!