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

Declared session in BaseController to avoid Creation of dynamic property in php 8.2 #6996

Merged
merged 8 commits into from Dec 24, 2022
Merged

Conversation

ghost
Copy link

@ghost ghost commented Dec 20, 2022

Declared session property in the BaseController to avoid the depreciation of dynamic properties in PHP 8.2

@samsonasik
Copy link
Member

I prefer to just write comment instead, as session may or may not be used, session init is also commented under init method.

@kenjis kenjis changed the title 4.3 Declared session in BaseController to avoid Creation of dynamic property in php 8.2 Declared session in BaseController to avoid Creation of dynamic property in php 8.2 Dec 20, 2022
@@ -37,6 +37,13 @@ abstract class BaseController extends Controller
*/
protected $helpers = [];

/**
* To declare the session propety to allow for global
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* To declare the session propety to allow for global
* To declare the session property to allow for global

* initialization in the initController() method
* See the Creation of dynamic property depreciation i php 8.2
*/
// public $session;
Copy link
Member

Choose a reason for hiding this comment

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

protected modifier is fine since the code is commented

Copy link
Member

Choose a reason for hiding this comment

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

It should be protected, because we don't need to set it public.

@MGatner
Copy link
Member

MGatner commented Dec 22, 2022

I appreciate the thoroughness but I'm fine expecting developers to handle this themselves. A compromise might be expanding the comment below under initController to say something like "be sure to declare properties for anything you assign."

Copy link
Author

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Cleaned up the comment regarding the depreciation of dynamic properties and set the session method to be protected in the BaseController

@kenjis
Copy link
Member

kenjis commented Dec 23, 2022

@thenerdyshark We do not use git merge. Please use git rebase to update your branch.
See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#updating-your-branch

Copy link
Contributor

@datamweb datamweb left a comment

Choose a reason for hiding this comment

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

Thanks!

@kenjis kenjis merged commit 5fac896 into codeigniter4:develop Dec 24, 2022
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.

6 participants