Jump to content
MoritzLost

Exception when using bd on a module extending Wire directly

Recommended Posts

Hi @adrian, I've got another small issue between TracyDebugger and one of my modules. Not sure if the problem is Tracy, my module or the core, anyway ...

The problem is my ProcessCacheControl module, which comes with two module files: ProcessCacheControl itself, which is a Process module, and the helper module CacheControlTools, which implements the Module interface but extends Wire (instead of WireData). When dumping an instance of the CacheControlTools module, I get a fatal exception:

Quote

Method CacheControlTools::get does not exist or is not callable in this context

Steps to reproduce:

  1. Install ProcessCacheControl
  2. In the console or any template, try to dump an instance of the module using d / bd:
    d($modules->get('CacheControlTools'));

The stack trace indicates TD.php#L281 as the cause. Specifically, $var->get('title|name') results in Wire->__callUnknown which results in the error above (see attached screenshot).

I guess the debugger assumes that the module extend WireData instead of Wire? If I change the module to extend WireData, the exception goes away. Though I would like to keep it extending Wire, since that module doesn't hold any data or state, so extending WireData doesn't make any sense. Maybe this could be handled by Tracy?

Thanks!

Screenshot 2021-03-05 at 14.12.06.png

  • Like 1

Share this post


Link to post
Share on other sites

Hi @MoritzLost - I assume you are using PHP8?

This used to be OK on PHP7, but 8 seems to have become more strict about blank vs zero. It should be fixed in the latest version.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks @adrian!

Sorry I forgot to mention the versions ^^ The site I ran into this problem is still on PHP 7.4, but the update fixed the problem nonetheless. Thanks for the quick response!

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...