Skip to content

Typed property Symfony\Component\Cache\Adapter\TraceableAdapterEvent::$end must not be accessed before initialization #48910

@Bilge

Description

@Bilge

Symfony version(s) affected

6.2.4

Description

When an exception is thrown in debug mode in the callback passed to Symfony\Contracts\Cache\CacheInterface::get(string $key, callable $callback), Symfony will end up masking the exception with its own as CacheDataCollector throws the following exception:

Typed property Symfony\Component\Cache\Adapter\TraceableAdapterEvent::$end must not be accessed before initialization in symfony\cache\DataCollector\CacheDataCollector.php on line 118.

$statistics[$name]['time'] += $call->end - $call->start;

How to reproduce

Probably something like the following should get it to trigger, although in my testing, it does not.

$cache->get(
    'foo',
    function (ItemInterface $item) {
        throw new \Exception;
    }
);

I am not sure what it is about my app in particular that triggers it, but the exception is actually thrown from a fiber, in case that matters. Here's a snapshot of $calls.

image

Possible Solution

No response

Additional Context

This does not happen on Symfony 5.4; the correct userland exception message and trace is shown, instead of one coming from Symfony's components.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy