Page 1 of 1

Replacing deprecated functions

Posted: Tue Jul 26, 2022 6:48 pm
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

Re: 1.0.8.5 Questions / Comments / Concerns

Posted: Tue Jul 26, 2022 7:33 pm
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.