Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Jun 18, 2025

Normal debug() breaks templates and JS, so with debug kit enabled this should go into dump panel IMO

Anywhere:

debugKitDump('fpopbar');

...

debugKitDump('rrrr');

Proof of concept.

Before
before

After
a

and
after

@dereuromark
Copy link
Member Author

dereuromark commented Jun 18, 2025

Downside of own method:
If debugkit is not loaded, this will fail hard.

Using debug() should be preferred, but my tests revealed that core one is loaded first, so not sure how to fix that up.
When locally debugging, I think it is fine usually to require this method to be removed again after usage.

@dereuromark dereuromark requested a review from markstory July 16, 2025 22:19
@LordSimal
Copy link
Contributor

I have no strong opinions about this, since I wouldn't really use this feature.
Besides the fact that it breaks the usual PHP debugging convention, where the debug output is printed where it is executed.

But if people like to have more options to do that, I am fine with that as well.

@dereuromark
Copy link
Member Author

File and line is still visible, same as logging it always is

Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you want to defer output, why would someone use this over Log?

<div class="c-dump-panel">
<?php
foreach ($statements as $statement) {
echo '<pre class="cake-debug-string">' . h($statement['var']) . '</pre>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to handle more complex values as well? If we're only going to support simple values, one could use logging instead.

@dereuromark dereuromark deleted the 5.next-dump-panel branch August 10, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants