Deprecated Functions

Open to all! Ask other shopowners for help.
Post Reply
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Deprecated Functions

Post by Xpajun »

I'm getting these errors:

Code: Select all

[29-May-2023 19:17:04 UTC] PHP Deprecated:  The tep_href_link function has been deprecated. in /home/*****/public_html/store4/admin/includes/functions/html_output.php on line 51
[29-May-2023 19:17:04 UTC] PHP Deprecated:  The tep_image function has been deprecated. in /home/*****/public_html/store4/admin/includes/functions/html_output.php on line 63
[29-May-2023 19:17:04 UTC] PHP Deprecated:  The phoenix_normalize function has been deprecated. in /home/*****/public_html/store4/admin/includes/functions/html_output.php on line 26

What have I missed out?

On checking I also found a number of other similar lines as code:

Code: Select all

        trigger_error('The tep_catalog_href_link function has been deprecated.', E_USER_DEPRECATED);


Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18


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: Deprecated Functions

Post by ecartz »

Somewhere in the code that you have, you're using the functions tep_href_link, tep_image, and phoenix_normalize. This could be

1. A file that didn't get updated in core.
2. An add-on that hasn't been updated yet.
3. Code that is entirely custom to your site, e.g. in a template or a hook or a core modification.

Unfortunately, it's not going to be the file that is in the message that is the problem. Something somewhere is calling those functions. It's going to be those files that you need to edit.

All that said, if you just want to get rid of the log messages, you can change your error reporting. In your includes/configure.php file, change to

Code: Select all

error_reporting(E_ALL&~E_DEPRECATED);
The problem with that is that eventually those functions will go away (that's what deprecated means, something still here that will go away in the future). It would be better to rewrite the callers so that they don't use the deprecated functions. That's a longer term solution than just turning off the messages.
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Deprecated Functions

Post by Xpajun »

ecartz wrote: Mon May 29, 2023 8:23 pm Somewhere in the code that you have, you're using the functions tep_href_link, tep_image, and phoenix_normalize. This could be

1. A file that didn't get updated in core.
2. An add-on that hasn't been updated yet.
3. Code that is entirely custom to your site, e.g. in a template or a hook or a core modification.

Unfortunately, it's not going to be the file that is in the message that is the problem. Something somewhere is calling those functions. It's going to be those files that you need to edit.

All that said, if you just want to get rid of the log messages, you can change your error reporting. In your includes/configure.php file, change to

Code: Select all

error_reporting(E_ALL&~E_DEPRECATED);
The problem with that is that eventually those functions will go away (that's what deprecated means, something still here that will go away in the future). It would be better to rewrite the callers so that they don't use the deprecated functions. That's a longer term solution than just turning off the messages.
I see Error reporting as being there for a reason - not for turning off ;)

What I have just done Matt is done a Multi File search for tep_href_link it's shown up in:
html_output.php
gdpr.php
logoff.php
ssl_check.php
href_link.php
They are all in my copy of 1.0.8.19-master which is what I upgraded to 1.0.8.20
Going to have a look at it tomorrow to see if I can find the files that didn't get updated in core.
I think I may have found it now but not totally sure - it looks like it is another of my :roll: :roll:
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18
User avatar
burt
Core Team
Posts: 4561
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 422 times

Re: Deprecated Functions

Post by burt »

Rainer @raiwa put together and is maintaining a Change Log and has kindly made it public viewable. It shows what has changed and when.

https://docs.google.com/spreadsheets/d/ ... edit#gid=0

It's a very good resource. Basically find the line of code that is in your file, let's say it is;

tep_href_link('gdpr.php')

Then find the closest similar one in the spreadsheet. That looks like the one on Line 150 of the spreadsheet. Change it to match column D. In this case;

$Linker->build('gdpr.php')

Thank you to Raiwa for the spreadsheet and maintenance of it!
I am not here to build for you.
I am here to build with you. Let's help each other.
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Deprecated Functions

Post by Xpajun »

burt wrote: Tue May 30, 2023 7:58 am Rainer @raiwa put together and is maintaining a Change Log and has kindly made it public viewable. It shows what has changed and when.

https://docs.google.com/spreadsheets/d/ ... edit#gid=0

It's a very good resource. Basically find the line of code that is in your file, let's say it is;

tep_href_link('gdpr.php')

Then find the closest similar one in the spreadsheet. That looks like the one on Line 150 of the spreadsheet. Change it to match column D. In this case;

$Linker->build('gdpr.php')

Thank you to Raiwa for the spreadsheet and maintenance of it!
Thank you Gary @burt - I think I have looked at it before but have forgotten about it
And thanks to Rainer @raiwa For the Change log as well
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Deprecated Functions

Post by ecartz »

In this particular case, you could look at https://github.com/CE-PhoenixCart/Phoen ... 4f675de17d as well. That's the commit that changed these in core. Or just get the current copies of these files and use those.

When making the changes in core, I just searched for tep_ outside of the functions directories.
Xpajun
Contributor
Posts: 187
Joined: Thu Mar 04, 2021 1:18 pm
Phoenix Version: v1.0.9.0
Has thanked: 3 times
Been thanked: 6 times

Re: Deprecated Functions

Post by Xpajun »

ecartz wrote: Tue May 30, 2023 11:47 pm In this particular case, you could look at https://github.com/CE-PhoenixCart/Phoen ... 4f675de17d as well. That's the commit that changed these in core. Or just get the current copies of these files and use those.

When making the changes in core, I just searched for tep_ outside of the functions directories.
Matt @ecartz , thank you so far... Is there a commit that covers Admin changes? I'm having problems with some of the deprecated functions - that is:
phoenix_normalize
phoenix_append_css
tep_draw_form (uses phoenix_normalize which has been deprecated?)
those with phoenix_normalize I'm not sure how to change - I can't find any examples
Also the jQuery UI Button and again the bootstrap button

The rest seem fairly straightforward
Current Store is now running 1.0.9.0 - php 8.2.18
Now working on taking a short rest :D - php 8.2.18
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Deprecated Functions

Post by ecartz »

Here is the latest version of all the admin files: https://github.com/CE-PhoenixCart/Phoen ... 8.21/admin

If you click one, e.g. action_recorder.php, and then click History, it will show you https://github.com/CE-PhoenixCart/Phoen ... corder.php

In that list, look for Modernize action_recorder page: https://github.com/CE-PhoenixCart/Phoen ... 53278b704a

Other pages should work similarly.

For phoenix_normalize, it takes a string like phoenix_normalize('key1=' . $value1 . '&key2=' . $value2) and turns it into an array, e.g. ['key1' => $value1, 'key2' => $value2] so just change the string to an array and remove phoenix_normalize.


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