Depractaion request warning |
I am queite new to codeigniter and having some issues with the request object.
I am trying to pass some tokens from before filter to the request object but getting some depracation warning when trying to access it from controller ``` // before filter $request->decodedToken = $decoded; ``` ``` // after filter public function logout() { $originalToken = $this->request->originalToken ?? null; } ``` WARNING - 2024-04-19 12:40:09 --> [DEPRECATED] Creation of dynamic property CodeIgniter\HTTP\IncomingRequest::$originalToken is deprecated in APPPATH/Filters/AuthFilter.php
You can't do that. Use sessions, cookies. Strangely, it seems that the request cannot store parameters. kenjis will complete the information
PHP community decided that Creation of dynamic property is a bad practice.
Quote:The core problem is that reading from a non-existing property issues a diagnostic that makes the issue immediately apparent, while writing to a non-existing property is entirely silent. PHP gives no indication whatsoever that the programmer has made a mistake. So you should not use it. If you use class properties, you should define them in the class. |
Welcome Guest, Not a member yet? Register Sign In |