ACF-composer / ACF blocks - how to debug?

Hi all,

I am using ACF Composer to create blocks for Gutenberg. What I have found is that it is incredibly hard to debug the code for this so I am looking for some pro tip.

If I, for example, add a random “b” somwehere in a block or field which would, “normally”, trigger the fatal error “Undefined constant ‘b’”, the editor loads just fine but the block stops working (not showing up among the available blocks) but I can not for the life of me find what the error actually is.

Now, replace my intentional error with any of the millions of small bugs one create during a normal coding session and I have spent numerous hours looking for the cause of bugs that would have taken seconds to fix if something just could have told me where and what the problem is. Yes, those numbers are slightly exaggerated but you get my point.

  • WP_ENV is “development”
  • There’s nothing in debug.log
  • Checking XHR-responses in dev tools gives me nothing
  • If I add an error in index.php or in render-parts of blocks, those get nicely output by the friendly Symfony ghost.
  • Not even using good old die() or dump() gets me far.
  • I am using Ray but even that takes some time and does not always help since I have to place the ray()-calls in the right spot in the code in order to start backtracing.
  • Please don’t let the only solution be to use Xdebug :slight_smile:

Just now I spent too much time looking for an error caused by me extending the wrong class. Not even PHP storm was able to spot the error.

Any input (even if it is Xdebug related) is welcome.

The lack of being able to debug ACF Composer (and other packages) stems from skipProvider() skipping over packages with errors.

I don’t think it’s been discussed as an issue yet, but it might be worth looking into.

I’m with you on this, I also find it really difficult. Enabling logging with acorn helped a bit:

But I still struggle sometimes to quickly catch any typo’s etc.

Thank you for input and suggestions. I followed the instructions in the link from GH-issue and got that working :+1:

This topic was automatically closed after 42 days. New replies are no longer allowed.