Skip to content

fix: debug toolbar logs collector behavior on isEmpty() - #9724

Merged
paulbalandan merged 5 commits into
codeigniter4:developfrom
mjomble:fix-debug-toolbar-logs
Oct 1, 2025
Merged

fix: debug toolbar logs collector behavior on isEmpty()#9724
paulbalandan merged 5 commits into
codeigniter4:developfrom
mjomble:fix-debug-toolbar-logs

Conversation

@mjomble

@mjomblemjomble commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Description
Fixed bug introduced in #9581 and described in this comment

  • isEmpty() was checking the opposite
  • The checks did not work if $this->data was null

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@mjomble

Copy link
Copy Markdown
ContributorAuthor

I'll look into adding a unit test for the Logs controller

@mjomble
mjomble marked this pull request as draft September 18, 2025 09:22
@mjomble
mjomble marked this pull request as ready for review September 18, 2025 10:42
@mergeable

mergeableBot commented Sep 18, 2025

Copy link
Copy Markdown

Hi there, mjomble! 👋

Thank you for sending this PR!

We expect the following in all Pull Requests (PRs).

Important

We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works.

If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work
on the framework than you do. Please make it as painless for your contributions to be included as possible.

See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md

Sincerely, the mergeable bot 🤖

@paulbalandanpaulbalandan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code change and added test looks good. Thanks for that. However, I'm not sure about adding the default [] to the $data property. Well, theoretically this is a breaking change as the initial state would now be [] instead of null. But, practically speaking, the intent was to treat $data as an array. It's just probably that when this class was created, typed properties were not yet a thing. So, this is a bug fix.

Let's hear from others on their take on this.

@datamwebdatamweb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Comment threadsystem/Debug/Toolbar/Collectors/Logs.php
michalsn
michalsn previously approved these changes Sep 27, 2025

@michalsnmichalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In this case, I’m fine with treating changes to the $data property as a bug fix, though I hope this doesn't open the door to making similar adjustments too easily in the future.

@paulbalandanpaulbalandan added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 27, 2025
@michalsn

Copy link
Copy Markdown
Member

@mjomble Please also add a changelog entry, here: https://github.com/codeigniter4/CodeIgniter4/blob/develop/user_guide_src/source/changelogs/v4.6.4.rst#bugs-fixed

PHPStan errors should be gone after merging #9728, so you don't have to worry about it.

@michalsn
michalsn dismissed their stale reviewOctober 1, 2025 06:19

Changelog entry is missing

@mjomble

Copy link
Copy Markdown
ContributorAuthor

I've updated the changelog

Comment threaduser_guide_src/source/changelogs/v4.6.4.rst Outdated
@paulbalandanpaulbalandan changed the title fix: Debug toolbar logs controllerfix: debug toolbar logs collector behavior on isEmpty()Oct 1, 2025
@paulbalandan
paulbalandan merged commit b352164 into codeigniter4:developOct 1, 2025
50 checks passed
@paulbalandan

Copy link
Copy Markdown
Member

thank you @mjomble

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugVerified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@mjomble@michalsn@paulbalandan@datamweb@neznaika0