Skip to content
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

[BUG]: View->reset() sets contents to NULL instead of empty string #16437

Closed
dugwood opened this issue Sep 25, 2023 · 1 comment
Closed

[BUG]: View->reset() sets contents to NULL instead of empty string #16437

dugwood opened this issue Sep 25, 2023 · 1 comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Comments

@dugwood
Copy link
Contributor

dugwood commented Sep 25, 2023

Describe the bug
Reset of view doesn't use the default class value of ->content (= empty string), which will raise an error on PHP 8.2

To Reproduce
Here the content is set to NULL instead of an empty string: https://github.com/phalcon/cphalcon/blob/5.0.x/phalcon/Mvc/View.zep#L771

Which will raise:

Phalcon\Http\Response::setContent(): Passing null to parameter #1 ($content) of type string is deprecated

I don't have an example, but it happens when I'm redirecting the user before rendering the view (using Dispatcher's events). Most probably because of view->disable(). But in the end, view->content should not be initialized with NULL.

Expected behavior
View should be reset as expected.

Details

  • Phalcon version: 5.2.2 (but 5.2.4 has the same code)
  • PHP Version: 8.2.7
  • Operating System: Linux Debian stable
  • Installation type: PECL
  • Zephir version (if any): -
  • Server: Lighttpd
@dugwood dugwood added bug A bug report status: unverified Unverified labels Sep 25, 2023
@rudiservo rudiservo mentioned this issue Sep 25, 2023
4 tasks
niden added a commit that referenced this issue Sep 25, 2023
@niden niden added status: medium Medium 5.0 The issues we want to solve in the 5.0 release and removed status: unverified Unverified labels Sep 25, 2023
@niden niden added this to Phalcon v5 Sep 25, 2023
@niden niden moved this to Implemented in Phalcon v5 Sep 25, 2023
@niden
Copy link
Member

niden commented Sep 25, 2023

Resolved in #16438

Thank you @dugwood and @rudiservo

@niden niden closed this as completed Sep 25, 2023
@niden niden moved this from Implemented to Released in Phalcon v5 Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
Status: Released
Development

No branches or pull requests

2 participants