Skip to content

Conversation

@ping-yee
Copy link
Contributor

@ping-yee ping-yee commented Sep 9, 2022

Description
Modified #6523.

Checklist:

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

@ping-yee ping-yee changed the title modify: variable changed. modify: variable global $app changed. Sep 9, 2022
@kenjis kenjis added the refactor Pull requests that refactor code label Sep 9, 2022
@kenjis kenjis changed the title modify: variable global $app changed. refactor: variable global $app changed. Sep 9, 2022
@kenjis kenjis changed the title refactor: variable global $app changed. refactor: replace global $app with Services Sep 9, 2022
@iRedds
Copy link
Collaborator

iRedds commented Sep 10, 2022

I understand the reason for this PR, but I don't think it's the right solution.

To begin with, the Services::codeigniter() service was actually introduced at the suggestion of a developer who wanted to change the request handler.
The reason for this was the unsuccessful design of the framework and the rejection of autowiring.
Therefore, I do not consider it necessary to implement this service, which is a crutch.

I also think that the design of the toolbar filter is bad. Instead of simply injecting a toolbar header or script into the response, data collection is additionally triggered.

I think the way the toolbar works should be changed instead of using Services::codeigniter().

Codeigniter::class

  • Initialization
    • filter toolbar::after( Turn on the toolbar. Inject a header or script into the response. )
    • sending the response
  • if the toolbar is enabled, we collect data, including timer data.

@ping-yee
Copy link
Contributor Author

ping-yee commented Sep 10, 2022

@iRedds Thanks for your advices, I understand what you mean and feel grateful.
Is there any alternative change can use?
If there isn't, I will close this PR.

@kenjis
Copy link
Member

kenjis commented Sep 10, 2022

@iRedds It seems true what you say, but this PR fixes the bug in Long-living PHP like RoadRunner.
I think even if a PR is not perfect, if it improves CI4, it is better to merge.

@iRedds
Copy link
Collaborator

iRedds commented Sep 11, 2022

I just expressed my opinion.
So which way to choose is up to you, gentlemen.

@kenjis
Copy link
Member

kenjis commented Sep 11, 2022

@ping-yee Can you remove this?

* @global \CodeIgniter\CodeIgniter $app

@kenjis
Copy link
Member

kenjis commented Sep 11, 2022

@iRedds Thank you for your opinion. You can send a PR to fix the bad design of the debugbar later.

@ping-yee
Copy link
Contributor Author

ping-yee commented Sep 12, 2022

@kenjis I have been taken out the comment out, appreciated that!

@kenjis kenjis merged commit 4509466 into codeigniter4:develop Sep 12, 2022
@ping-yee ping-yee deleted the Toolbar-modify-variable branch September 22, 2022 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants