Laravel 5.3 unauthorized() AuthenticationException fatal error - php

I've followed Laravel 5.3 upgrade guide, which says to add an unauthenticated method in App\Exceptions\Handler.
However, I get the following error when it gets called by the Auth system:
FatalThrowableError in Handler.php line 59:
Type error: Argument 2 passed to App\Exceptions\Handler::unauthenticated() must be an instance of App\Exceptions\AuthenticationException, instance of Illuminate\Auth\AuthenticationException given, called in /Users/Username/Development/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 135
I've been searching for the last half hour and couldn't find a solution.
Any help?

Check how your Handler.php file compares to the 5.3 branch version here: https://github.com/laravel/laravel/blob/5.3/app/Exceptions/Handler.php
Note the unauthenticated() method in Handler.php expects an instance of \Illuminate\Auth\AuthenticationException. Make sure use Illuminate\Auth\AuthenticationException; is included at the top of the file.

In my case, i just deleted whoops... or restore the default Handler.php

I had this Error 500 inexplicable issue while upgrading from Laravel 5.2 to 5.3. No laravel error logs in storage/logs, no Apache error logs. no issue with .env, debug was turned on, no broken .htaccess directives, plus php artisan could not run. Tried everything until I looked in the PHP error logs and found:
PHP Fatal error: Uncaught Error: Undefined constant 'Illuminate\Auth\AuthenticationException' in C:\code\laravel-project\vendor\laravel\framework\src\Illuminate\Container\Container.php:79
So I did what #jon suggested and compared my Handler.php file with the fresh laravel one and found this:
In your App/Exceptions/Handler.php make sure that the classes in the $dontreport array are referenced as either strings in quotes:
'\Illuminate\Auth\AuthenticationException',
'\Illuminate\Auth\Access\AuthorizationException',
'\Symfony\Component\HttpKernel\Exception\HttpException',
'\Illuminate\Database\Eloquent\ModelNotFoundException',
'\Illuminate\Session\TokenMismatchException',
'\Illuminate\Validation\ValidationException',
or this way:
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
For some reason I found mine to not have the quotes and fixing that got rid of the Error 500.

Related

PHP Fatal Error with Userfrosting now server always shows Error 500

I was managing my server and after a composer update I receive this message:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to UserFrosting\System\Facade::setFacadeContainer() must be an instance of Interop\Container\ContainerInterface, instance of Slim\Container given, called in /home/arteller/www/userfrosting/app/system/UserFrosting.php on line 53 and defined in /home/arteller/www/userfrosting/app/system/Facade.php:210
After this, I receive only 500 Internal Error from my server.
The error persists every time I also try to use the command "php bakery bake" or something related to bakery.
Anyone can help?
You need to update to UserFrosting 4.3.3 or later, and run composer update again. This issue was introduced by Slim, which introduced a breaking change recently.

Kohana project doesn't work after moving to different server

Recently I had to work with Kohana 3.3.1 Framework project (which works). I moved it to my computers localhost, and it doesn't work there. I have set up the mysqli server, tried it on apache and nginx and both give me the same error
ErrorException [ Fatal Error ]: Call to undefined function __()
SYSPATH/classes/Kohana/Kohana/Exception.php [ 53 ]
53 $message = __($message, $variables);
{
Fatal error: Call to undefined function __() in /usr/share/nginx/www/system/views/kohana/error.php on line 64
Have I forgotten something? I have also tried giving it 777 permission, and still the same error.
Please check filenames. Probably during send to server it's change to lowercase. Unix like servers knows difference.
Or check is all files are present on server.
This error is caused beacuse you don't have system/classes/Kohana/I18n.php file.
Or check besedir jail.

CodeIgniter Database Session Error

When I try to execute any controller of my CodeIgniter project i receive this error:
Fatal error: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in D:\Git\crud-farm\system\libraries\Session\drivers\Session_files_driver.php on line 49
A PHP Error was encountered
Severity: Error
Message: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read)
Filename: drivers/Session_files_driver.php
Line Number: 49
Backtrace:
I tried to replace CodeIgniter system files but it didn't work. The problem appears in all projects
Problem solved by restarting Apache.
I attach the url which saved me: http://forum.codeigniter.com/thread-64763.html
In my case i did the following
Restart apache
That's it!
The files in system should not be modified. My files were modified somehow and were throwing error. I resolved my problem as below.
Download fresh codeigniter and extract files
copy system files from fresh codeigniter into your project and overwrite the whole system folder.
This should fix your problem.

How to detect which file error in Lavel 5

I'm learing laravel 5. A day, when I run php artisan command I got this error
Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in C:\xampp\htdocs\premiumlens\vendor\laravel\framework\src\Illuminate\Routing\RoutingServiceProvider.php on line 62 and defined in C:\xampp\htdocs\premiumlens\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php on line 102
Almost application functions work perfect. But may not all. I'm sure the error is not caused by UrlGenerator.php
Now I cant use any artisan functions. How can I detect which file cause this issue.
Thank you !
I think you used url() helper in your config file, find where you put url() helper in your config file and remove it. your problem will be solved. i had this same problem and solved by removing url() form config file..
url('bassets/plugins/highcharts/highcharts.css'),

Ion Auth - "sess_destroy()" Fatal Error when logging out

I have downloaded the very latest version of IonAuth for Codeigniter on GitHub. It is a very good library however when I try to logout after logging in I get the following error (which I've had in previous builds) - I know I can just comment the lines out but is there a reason for the errors?
Fatal error: Call to undefined method CI_Session::sess_destroy() ....\Ion_auth.php on line 381
I just kept them commented out.. seems to wrk

Categories