Laravel FatalErrorException in Handler.php line 25 - php

I'm getting the following error on random occasions, working on a Laravel 5.1 project on the latest homestead with PHP7
FatalErrorException in Handler.php line 25:
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of TypeError given, called in /home/vagrant/Code/henau/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/henau/app/Exceptions/Handler.php:25
Stack trace:
#0 /home/vagrant/Code/henau/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): App\Exceptions\Handler->report(Object(TypeError))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(TypeError))
#2 {main}
thrown
Even when I undo work that has been causing it, It stays. It's being caused by this block of code in this instance
\Mail::send('emails.registered', $user, function ($m) {
$m->to('miguel#dummyaddress.com')->subject('New Order');
});
It seems to me the error is not directly code-related. I've seen other people encounter it in complete different situations. And i've seen it popup in older threads regarding Homestead and PHP7. There was an askubuntu thread but it's offline, So I hope we can reopen the discussion here.

Solution
This is actually an error that an exception can't be shown. This is caused by using PHP7.x on an older Laravel project that requires PHP5.6.x
My solution was to create a new Homestead specific for this project and install php5.6 on that homestead using an older version of laravel/homestead

I had the same problem when running seeders Notflip . I'm usign Laravel framework 5.0.34. I had this structure:
App/Models/Users/ (My users's Models here)
After moving my users's models to the App directory, my seeder problem was solved.
Check your namespaces and put under consideration your Laravel Framework version before make changes in the framework.
Hope it helps!

This situation occur when laravel project version not compatible or not configured with your local installed version So the laravel not tracking the exact error and instead of showing exact error on line shows that type of errors
i had same problem in laravel 5.1. After reading this issue, i found out i was using laravel v5.1.0 and that seemed wrong so changed 5.1.0 to 5.1.* and ran composer update. this solved the issue for me.

Related

Grav 1.7 Installation fails bc of call to undefined method

Cross post from https://github.com/getgrav/grav/issues/3523
(don't kill me, I didn't know that it's frowned upon)
I am not sure if this is the place to ask for help, so tell me if it's not (and maybe where to ask).
I am trying to update to the latest Grav release 1.7.29 from (originally 1.6.24, while troubleshooting today updated to) 1.6.31 (using direct-install.
I tried updating with self-upgrade and direct-install <latestVersionURL>.
But, while trying to install, it gives me the following error:
Installing upgrade... [30-Jan-2022 17:04:37 Europe/Cityxy] PHP Fatal
error: Uncaught Error: Call to undefined method
Grav\Common\Utils::basename() in
/var/www/virtual/name/html/tmp/Grav-61f6b713f0bb9/zip/grav-update/system/src/Grav/Installer/VersionUpdate.php:29
Stack trace:
#0 /var/www/virtual/name/html/tmp/Grav-61f6b713f0bb9/zip/grav-update/system/src/Grav/Installer/VersionUpdater.php(126):
Grav\Installer\VersionUpdate->__construct('/var/www/virtua...',
Object(Grav\Installer\VersionUpdater))
#1 /var/www/virtual/name/html/tmp/Grav-61f6b713f0bb9/zip/grav-update/system/src/Grav/Installer/VersionUpdater.php(38):
Grav\Installer\VersionUpdater->loadUpdates()
#2 /var/www/virtual/name/html/tmp/Grav-61f6b713f0bb9/zip/grav-update/system/src/Grav/Installer/Install.php(239):
Grav\Installer\VersionUpdater->__construct('core/grav',
'/var/www/virtua...', '1.7.29', Object(Grav\Installer\Versions))
#3 /var/www/virtual/name/html/tmp/Grav-61f6b713f0bb9/zip/grav-update/system/src/Grav/Installer/Install.php(184):
Grav\Installer\Install->prepare()
#4 /var/www/virtual/name/html/system/src/Gra in /var/www/virtual/eduref/html/tmp/Grav-61f6b713f0bb9/zip/grav-update/system/src/Grav/Installer/VersionUpdate.php
on line 29
From my understanding the files between versions have been changed, and looking at the Grav documentation, the called method basenames() is now in Grav/Common/URI, not in Grav/Common/Utils.
So I assume I located the problem, but have no idea on fixing it. Since I am not very well versed on this whole topic of managing websites (never set up the site, only maintaining it), I would really appreciate a safe answer on how to update Grav to the newest version which doesn't risk me destroying the functioning of the website.
Thank you for helping! :)
Tried with:
PHP: 7.3 & 7.4
Grav: 1.6.24 & 1.6.31
Admin: 1.9.10
Host: Uberspace
via SSH
Particular issue fixed:
https://github.com/getgrav/grav/issues/3523
following issue open:
https://github.com/getgrav/grav/issues/3532

Logger does not work anymore after upgrade from Laravel 5.5

Since I've upgraded to Laravel version 5.6 from Laravel version 5.5 my Logger doesn't work properly anymore.
At first I got the following error stack :
laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /home/vagrant/Code/grotesmurf/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)
which was solved by simply adding the new config/logging.php file that is provided by Laravel 5.6.
But now I'm getting no output from the Logger! I'm simply running \Log::info('hello!') as a tinker command, but it doesn't generate any log output anymore (same for scripts calling the \Log() method).
I've tried different LOG_CHANNEL settings (daily, single, stack), but none of these work.
Hope anyone has ran into this error already and is able to provide me with some suggestions. I have followed the upgrade guide and it doesn't help unfortunately.
Thanks in advance.
P.S. I'm running php version 7.1 & am on ubuntu.
P.P.S. I have cleared all cached config using artisan.
Well I have found the actual problem, we use an adjusted storage_path() method in our application and the new Logger is now using the storage_path() method to generate its path - this caused the log file to be created in a different directory than storage/logs.
i had the same issue, deleting the files in bootstrap/cache solved it.

Laravel Scout, Lumen application gives [ErrorException] Missing argument 1 for Illuminate\Support\Manager::createDriver()

When deploying lumen application with Codeship I get an error
[ErrorException]
Missing argument 1 for Illuminate\Support\Manager::createDriver(), called i
n /home/rof/src/bitbucket.org/rakkle/rakkleapi/vendor/illuminate/support/Ma
nager.php on line 88 and defined
It comes when the deployment runs the seeder class for the eloquent model associated.
I don't get this error on my local machine. In the bootstrap/app.php I have added
$app->instance('path.config', app()->basePath() . DIRECTORY_SEPARATOR . 'config');
$app->configure('scout');
$app->register(Laravel\Scout\ScoutServiceProvider::class);
$app->register(ScoutEngines\Elasticsearch\ElasticsearchProvider::class);
Yes I am using a custom scout engine, which works perfect on my machine.
I have come to a point where I know it's laravel/scout package giving the problem because when I remove the Searchable trait from the eloquent class that's giving the problem, the deploy run successfully.
I would like some insight and some direction in solving this issue.
Thanks
I found a solution to this problem.
Here's the full error that I duplicated on my machine
ErrorException: Missing argument 1 for Illuminate\Support\Manager::createDriver(), called in /var/www/vendor/illuminate/support/Manager.php on line 88 and defined
/var/www/vendor/illuminate/support/Manager.php:77
/var/www/vendor/illuminate/support/Manager.php:88
/var/www/vendor/illuminate/support/Manager.php:63
/var/www/vendor/laravel/scout/src/EngineManager.php:21
/var/www/vendor/laravel/scout/src/Searchable.php:203
/var/www/vendor/laravel/scout/src/Searchable.php:56
/var/www/vendor/laravel/scout/src/Searchable.php:35
/var/www/vendor/illuminate/support/Traits/Macroable.php:78
/var/www/vendor/laravel/scout/src/Searchable.php:112
/var/www/vendor/laravel/scout/src/ModelObserver.php:61
/var/www/vendor/illuminate/events/Dispatcher.php:367
/var/www/vendor/illuminate/events/Dispatcher.php:199
/var/www/vendor/illuminate/events/Dispatcher.php:172
/var/www/vendor/illuminate/database/Eloquent/Concerns/HasEvents.php:148
/var/www/vendor/illuminate/database/Eloquent/Model.php:670
/var/www/vendor/illuminate/database/Eloquent/Model.php:518
/var/www/vendor/illuminate/database/Eloquent/Builder.php:734
/var/www/vendor/illuminate/support/helpers.php:936
/var/www/vendor/illuminate/database/Eloquent/Builder.php:735
/var/www/vendor/illuminate/database/Eloquent/Model.php:1357
/var/www/vendor/illuminate/database/Eloquent/Model.php:1369
/var/www/tests/PetListingTest.php:150
/var/www/tests/PetListingTest.php:93
What I had forgot to add was within the environment variables in codeship was the SCOUT_DRIVER that I was using for the search. I had it within the .env file, reason why it wasn't giving me the issue on my machine.

Error while upgrading laravel from 5.0 to 5.1

Today I decided to upgrade my app from Laravel 5.0 to 5.1. But while upgrading, I am facing the following issue:
Catchable fatal error: Argument 1 passed to Illuminate\Config\Repository::__construct() must be of the type array, integer given, called in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 32 and defined in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 23
Please help me. I need to get my app up and running once again. Thank You.
I was facing the same error, and the issue was:
I created manually the files compiled.php, routes.php, config.php, and services.json inside bootstrap/cache folder, but those files do not need to exist, they will be generated by Laravel application.
https://github.com/laravel/laravel/tree/master/bootstrap/cache
del storage/bootstrap/cache/[files], this resovle my problem

How can I use the newly revamped Dropbox-PHP API?

I would like to use the Dropbox-PHP API that has recently come under development again. It is located here: http://code.google.com/p/dropbox-php/
I did cloned it with hg clone https://dropbox-php.googlecode.com/hg/ dropbox-php and I get this file structure:
Dropbox/API.php
Dropbox/autoload.php
Dropbox/Exception/Forbidden.php
Dropbox/Exception/NotFound.php
Dropbox/Exception/OverQuota.php
Dropbox/Exception/RequestToken.php
Dropbox/Exception.php
Dropbox/OAuth/PEAR.php
Dropbox/OAuth/PHP.php
Dropbox/OAuth/Zend.php
Dropbox/OAuth.php
examples/accountinfo.php
examples/createaccount.php
examples/download_image.php
examples/getmetadata.php
examples/oauth_workflow.php
examples/uploading.php
But I get this error when trying to run accountinfo.php (or example):
Warning: include(Dropbox/autoload.php) [function.include]: failed to open stream
No such file or directory in dropbox-api/examples/accountinfo.php on line 7
Right, so then I move the Dropbox folder inside of where all the example files are and still get an error message:
Fatal error: Uncaught exception 'Dropbox_Exception' with message 'The OAuth class
could not be found! Did you install and enable the oauth extension?' in
examples/Dropbox/OAuth/PHP.php:36 Stack trace: #0 examples/accountinfo.php(9):
Dropbox_OAuth_PHP->__construct('', '') #1 {main} thrown in
examples/Dropbox/OAuth/PHP.php on line 36
So I'm obviously not doing something right but I have no idea what.
Also saw on the site where it has instructions on installing:
pear channel-discover pear.dropbox-php.com
pear install dropbox-php/Dropbox-alpha
I ran those two commands and it still won't work. I don't usually have any problems coding in PHP but the lack of documentation is a little frustrating.
Update
As noted in the accepted answer below my main problem was not having oAuth installed on the system. I'm running OS X 10.6 - if someone can provide some clear and easy instructions on how to build / install this to work with XAMPP / PHP 5.3 I will accept your answer. I've tried the articles online about using homebrew and such but these are flaky and do not seem to work for me. Guessing I will have to build / install it from scratch.
The Dropbox folder needs to be inside one of the folders in your include_path.
Edit:
Also oauth needs to be "installed" on the system and included in php.ini (when you do phpinfo() oAuth should show up as a module). then things should work.

Categories