Skip to content

fix: View::renderSection() return type #8965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2024

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 15, 2024

Description
From https://forum.codeigniter.com/showthread.php?tid=91082

The method should not use echo, because it has side effects.

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

@kenjis kenjis added bug Verified issues on the current code behavior or pull requests that will fix them breaking change Pull requests that may break existing functionalities 4.6 labels Jun 15, 2024
Copy link
Contributor

@neznaika0 neznaika0 left a comment

Choose a reason for hiding this comment

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

The bug is old. I came across this a long time ago, not a serious mistake and I agreed with it.
Do you need a return test? For example,
$section = $this->renderSection(”content") ?? ”Not content";

@kenjis kenjis force-pushed the fix-View-renderSection-return-type branch from 2990303 to bff0841 Compare June 17, 2024 02:17
@kenjis
Copy link
Member Author

kenjis commented Jun 17, 2024

Added a test.

Copy link
Contributor

@neznaika0 neznaika0 left a comment

Choose a reason for hiding this comment

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

Good

@kenjis kenjis merged commit d8ac60a into codeigniter4:4.6 Jun 24, 2024
42 checks passed
@kenjis kenjis deleted the fix-View-renderSection-return-type branch June 24, 2024 00:25
@ricctram
Copy link

ok thank you @kenjis .. do you think Is better to wait the 4.6.0 then?

@kenjis
Copy link
Member Author

kenjis commented Aug 16, 2024

If you want this soon, patch system/View/View.php by yourself.
https://github.com/codeigniter4/CodeIgniter4/pull/8965/files#diff-4a0d588299e7596abc008b8c30cfbbdd51be730d1a8ddf945704a5efcbb68cec
As you see, the change is only in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Pull requests that may break existing functionalities bug Verified 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