Replacing deprecated functions

Open to all! Ask other shopowners for help.
Post Reply
User avatar
edfaught
Member
Posts: 49
Joined: Mon Oct 26, 2020 3:22 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 2 times

Replacing deprecated functions

Post by edfaught »

Not sure this is the right topic...

What should I do, if anything, about deprecated functions?
The retain_parameters method has been deprecated. in /includes/system/versioned/1.0.8.5/href.php on line 79
The tep_require_login function has been deprecated. in/includes/functions/general.php on line 351
The tep_session_recreate function has been deprecated. in /includes/functions/sessions.php on line 32
The tep_reset_session_token function has been deprecated. in /includes/functions/sessions.php on line 37

1.0.8.5


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: 1.0.8.5 Questions / Comments / Concerns

Post by ecartz »

edfaught wrote: Tue Jul 26, 2022 6:48 pm The retain_parameters method has been deprecated. in /includes/system/versioned/1.0.8.5/href.php on line 79
The tep_require_login function has been deprecated. in/includes/functions/general.php on line 351
The tep_session_recreate function has been deprecated. in /includes/functions/sessions.php on line 32
The tep_reset_session_token function has been deprecated. in /includes/functions/sessions.php on line 37
If you look at the functions themselves, you will see the deprecation message followed by what to do instead (with a few exceptions). E.g. https://github.com/CE-PhoenixCart/Phoen ... p#L78..L81

Code: Select all

    public function retain_parameters(array $excludes = []) {
      trigger_error('The retain_parameters method has been deprecated.', E_USER_DEPRECATED);
      return $this->retain_query_except($excludes);
    }
So instead of retain_parameters, use retain_query_except. In that case, you can simply replace one method with another.

Similarly, https://github.com/CE-PhoenixCart/Phoen ... L350..L353 says to replace tep_require_login with Login::require -- again you can just replace one with the other.

From https://github.com/CE-PhoenixCart/Phoen ... ssions.php we see that tep_session_recreate can be replaced with Session::recreate and tep_reset_session_token can be replaced with Form::reset_session_token

Other functions may not have direct replacements like that, but those four do.

You can also look at raiwa's cheat sheet: https://docs.google.com/spreadsheets/d/ ... sp=sharing -- that may be easier than looking up the function in the source code.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply