php-jwt icon indicating copy to clipboard operation
php-jwt copied to clipboard

Class ExpiredException not found

Open rutwick opened this issue 11 years ago • 4 comments

I have been trying to fix this since quite a while now. After my token expires, I get this exception:

PHP Fatal error: Class 'ExpiredException' not found in C:\wamp...\php-jwt-master\src\JWT.php on line 119.

I tried adding the use statement to explicitly use the ExpiredException class, but it still gives me this error. I am trying to redirect the user by comparing the exp claim against the current time.

rutwick avatar Oct 13 '15 16:10 rutwick

Have you included ExpiredException.php (which defines the ExpiredException class)?

psignoret avatar Oct 21 '15 03:10 psignoret

sorry but am new to jwt, i get the same issue, i have the "ExpiredException" class but its empty, do i need to write an implementation for this ? this seems to be the case for all the other ...Exception.php files included

sadranyi avatar Nov 18 '15 10:11 sadranyi

@sadranyi You do not need to write an implementation for this, but if you want you could. Do note that it extends the UnexpectedValueException class, so it's not required at all.

The error @rutwick is reporting hasn't anything to do with an 'empty class' either. PHP simply can't find the class at all. Make sure ExpiredException.php is included, like @psignoret noted.

BondITSolutions avatar Jan 04 '16 15:01 BondITSolutions

As mentioined, this is an autoload error. The solution is to properly install this package with composer (and include vendor/autoload.php in this script, as documented in this package's README, or provide your own solution for loading the class files (NOT RECOMMENDED).

bshaffer avatar Jun 28 '23 17:06 bshaffer