-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Symfony version(s) affected
6.1.4
Description
Ok I appreciate this is a piss-poor bug report but it's all I have at the moment. Im logging it here in case others see the same thing, and if those with better Symfony skills have a 💡 moment and know exactly what the problem is.
How to reproduce
Using PHP 8.2RC ... (I know I know)
When deployed, on the very very first page load (so probably when compiling and caching the container) Im getting one of a few exceptions thrown (and caught into Sentry.io)
On the second page load, and on every single page load after the first page load the whole app is exception free and working fine, including the lines in the code that raise this initial exception - it all works perfectly in PHP 8.2 - once that first page load/cache/container compile is complete.
It also did not raise any exceptions using PHP 7/8/8.1 - this part of my codebase is untouched throughout the PHP cycles. With the exception of adding readonly to the constructor property I guess.
Their exception messages are truncated and incomplete - but are the full message.
"Cannot instantiate interface from"
and sometimes
"Error: Cannot instantiate trait from"
https://sentry.io/share/issue/de89a5060617453f9e660714e5cb5b9e/
Error: Cannot instantiate interface from
#6 /src/MyJoomla/Controller/UpdatesController.php(615): MyJoomla\Controller\UpdatesController::doExtensionUpgrade
#5 /vendor/symfony/http-kernel/HttpKernel.php(153): Symfony\Component\HttpKernel\HttpKernel::handleRaw
#4 /vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\Component\HttpKernel\HttpKernel::handle
#3 /vendor/symfony/http-kernel/Kernel.php(202): Symfony\Component\HttpKernel\Kernel::handle
#2 /vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner::run
#1 /vendor/autoload_runtime.php(29): require_once
#0 /public/index.php(15): null
Now, when inspecting my own code, I see that Im instantiating a Message and then dispatching it in the bus.
My message class is simple:
<?php
namespace App\Message;
class RemoteLogMessage extends AbstractAsyncMessage
{
}which extends the abstract class
<?php
namespace App\Message;
abstract class AbstractAsyncMessage
{
public function __construct(
private readonly array $data = []
) {
}
public function getData(): array
{
return $this->data;
}
}Possible Solution
No idea what the root cause or solution is.
One guess is that an abstract class must need one or more abstract methods? or not? its valid without else it would not work?
This error cannot be replicated on demand - but it has happened the last few times I have deployed to production - within seconds. (Production is a docker container in a docker swarm service)
Additional Context
Please no lectures on running PHP 8.2 RC2 in production ... someone has to find the bugs in the real world right :) hehe.

