-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal error: Declaration of Beste\Cache\InMemoryCache::getItem(string $key): Psr\Cache\CacheItemInterface must be compatible with PsrExt\Cache\CacheItemPoolInterface::getItem($key) in /vendor/beste/in-memory-cache/src/InMemoryCache.php on line 33 #5
Comments
Can you tell me where the A full stack trace of the error would be helpful. I'd need your PHP Version, your Thanks! |
Thank you very much for your fast response. We are using php 8.1.29, composer.json was created just using
I wish to know where exactly that error comes from as well, Sentry just shows line 33 in /vendor/beste/in-memory-cache/src/InMemoryCache.php as also mentioned in the error message itself. I'm afraid that's not the full stack trace we want. Is there code available I can temporally use to create one? |
I tried reproducing the problem: mkdir firebase-test
cd firebase-test
composer require kreait/firebase-php
composer require vlucas/phpdotenv Create a
Create a <?php
# test.php
declare(strict_types=1);
require 'vendor/autoload.php';
use Dotenv\Dotenv;
use Kreait\Firebase\Factory;
$dotenv = Dotenv::createUnsafeImmutable(__DIR__);
$dotenv->safeLoad();
$factory = (new Factory);
$auth = $factory->createAuth();
foreach ($auth->listUsers() as $user) {
echo "$user->uid\n";
exit;
} Then I ran docker run --rm -it -v $(pwd):/app -w /app php:8.1-cli php test.php or, with a locally installed PHP (8.3 in my case) php test.php This works for me - also, the CI Pipeline of the SDK is tested with PHP versions 8.1 to 8.4 and didn't report errors either. Can you share more information about your environment, other dependencies you have in your project, the PHP version you're using, etc. |
Again thank you very much for your fast response as well as your extensive instructions for testing this. Unfortunately this leads to exactly the same fatal error message as before. As I mentioned before we are using php 8.1.29. It's on Rocket Linux 8.10 (previously CentOS, based on RedHat Enterprise Linux). I've attached the CLI output for phpinfo(), I hope that may possibly already include a hint of what is be the issue. Next week I can try this on different systems to try to narrow down possible settings that may cause this. |
i face the same issue. |
For the time being, could you please try requiring version 1.3.0 explicitly in your project's composer.json? I feel as if 1.3.1, which removes a notice in PHP 8.4 introduces the fatal in PHP 8.1, and I would like to confirm that. If that's the case, I'll have to revert 1.3.1 in 1.3.2 and create a new major release for PHP 8.4... Sorry for the inconvenience! |
i have finally found the solution. and it's working now. |
Thanks for the insights, @tes123id - with your hint, I looked into this as well and found https://github.com/jbboehr/php-psr . This then led me to symfony/symfony#48934 and laravel/framework#46165 (among others). With this, I think this isn't something I can fix in code here - @davidbuzzard, if you remove the system package/module, you should get the needed classes/interface through the composer dependencies anyway. Thanks again! |
Thanks a lot @tes123id and @jeromegamez for finding the cause!! No chance we'd ever found that... Just for others finding this issue and using RHEL based distributions, you may want to do |
I'm trying to use the latest kreait/firebase-php which is using Beste\Cache\InMemoryCache by default. Following the setup instructions from https://firebase-php.readthedocs.io/en/7.14.0/setup.html (without auto-discovery) I'm getting following fatal error:
What are my options? Thanks in advance!
The text was updated successfully, but these errors were encountered: