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()
ordump()
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
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.