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

Deprecated: class-wp-feed-cache.php is deprecated since version 5.6.0 with no alternative available. #127

Closed
ThatStevensGuy opened this issue Dec 9, 2020 · 12 comments

Comments

@ThatStevensGuy
Copy link

ThatStevensGuy commented Dec 9, 2020

This plugin has an issue with WordPress 5.6. Commenting out line 99 feedwordpress.php seems to fix it. If someone could verify if this is the only issue with WP 5.6 and update the plugin that would be nice.

Deprecated: class-wp-feed-cache.php is <strong>deprecated</strong> since version 5.6.0 with no alternative available. This file is only loaded for backward compatibility with SimplePie 1.2.x. Please consider switching to a recent SimplePie version. in /Applications/MAMP/htdocs/website/wp-includes/functions.php on line 5059
Call Stack
#	Time	Memory	Function	Location
1	0.0030	456328	{main}( )	.../index.php:0
2	0.0038	495856	require_once( '/Applications/MAMP/htdocs/website/wp-admin/admin.php' )	.../index.php:10
3	0.0043	506560	require_once( '/Applications/MAMP/htdocs/website/wp-load.php' )	.../admin.php:34
4	0.0048	535832	require_once( '/Applications/MAMP/htdocs/website/wp-config.php' )	.../wp-load.php:37
5	0.0059	616792	require_once( '/Applications/MAMP/htdocs/website/wp-settings.php' )	.../wp-config.php:207
6	0.2770	23174760	include_once( '/Applications/MAMP/htdocs/website/wp-content/plugins/feedwordpress/feedwordpress.php' )	.../wp-settings.php:388
7	0.3003	24828872	require_once( '/Applications/MAMP/htdocs/website/wp-includes/class-wp-feed-cache.php' )	.../feedwordpress.php:116
8	0.3004	24828920	_deprecated_file( )	.../class-wp-feed-cache.php:15
9	0.3004	24829400	trigger_error ( )

The error is suppressed with WP_DEBUG set to false, but this should still be fixed.

@ThatStevensGuy
Copy link
Author

I can't tell if its related, but since making this change I also get:

Warning: ./cache is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable. in /Applications/MAMP/htdocs/website/wp-includes/class-simplepie.php on line 1510

@carstingaxion
Copy link

If someone could verify if this is the only issue with WP 5.6

Hello @ThatStevensGuy
I'm facing the same issue here, after updating from 5.4.1 to 5.6

@oppiansteve
Copy link
Contributor

I'm interested in this ticket too, as support for PHP 8 requires WP>=5.6

@kuniiskywalker
Copy link

In wordpress5.6, PHP 8
After disabling the WP_Feed_Cache dependency from wpCoreDependencies, synchronization is now possible for the time being.
The extent of the impact is unknown.

https://github.com/radgeek/feedwordpress/blob/master/feedwordpress.php#L99-L100

This will keep up until WP_Feed_Cache is supported.

@oppiansteve
Copy link
Contributor

oppiansteve commented Jan 15, 2021

@kuniiskywalker with your suggested change I'm seeing:

Error Level: E_USER_WARNING
Message: ./cache is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.
File: /wp-includes/class-simplepie.php
Line: 1510

whereas, without the change the deprecation doesn't break functionality, I think - it just gives those deprecation errors

(however, I've not had a chance to properly look at this yet)

@oppiansteve
Copy link
Contributor

...that said the error can be put out in some very annoying places

@kuniiskywalker
Copy link

@oppiansteve
I think so, too.

However, since WP_Feed_Cache is depricated, I think that the dependency should be eliminated.

It is necessary to create a new class that maintains the responsibility of WP_Feed_Cache.

Even in the cache save destination, the default is ./cache directory, and it seems that an error occurs with write permission in a specific environment. .. ..

@oppiansteve
Copy link
Contributor

Yes, sorry, I wasn't clear the error is that you've removed the caching mechanism and so the save will always fail.

My current thinking is to just move the one file into FWP, as the file is trivial (1 class with 1 method that has 1 line) and solves all the problems, I think.

A better solution would be to replace the caching with some other mechanism perhaps, but that's potentially a lot more work.

radgeek added a commit that referenced this issue Jan 18, 2021
… WP_Feed_Cache with replacement FeedWordPie_Cache class. (Should resolve PHP warnings: 'Deprecated: class-wp-feed-cache.php is <strong>deprecated</strong> since version 5.6.0', 'Message: ./cache is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.')
@radgeek
Copy link
Owner

radgeek commented Jan 18, 2021

Hey all, thanks for flagging and commenting on this issue.

This one took a little while to figure out. The apparent solution is not very complicated (I replaced the deprecated WP_Feed_Cache wrapper class with my own class, using code more or less copy-pasted from the WordPress Core and SimplePie caching classes). But the way that replacement cache handler classes hook in to SimplePie has gotten somewhat more complicated, so several other seemingly attractive solutions turned out to be dead ends and it took a lot of stepping through WordPress Core code to figure out why intended replacements weren't successfully taking over. (E.G.: Why not just replace WP_Feed_Cache with the still-supported WP_Feed_Cache_Transient? Well, it turns out SimplePie won't accept that as a replacement for SimplePie_Cache because it's not a subclass of SimplePie_Cache. OK, why not just copy over WP_Feed_Cache's methods over into FeedWordPie_Cache, make that a subclass, and then change all the class names in feedwordpress.php? Well, it turns out you need to re-implement the get_handler() and create() factory methods to force them to create an object using your new sub-class instead of just creating a SimplePie_Cache object. Etc. etc.)

Anyway, I just pushed a commit (see above) which I believe should resolve the issue with the Deprecated notice, without producing the warning about un-writeable cache directories (for those who do not have a cache directory with write permissions), and (also important) without breaking caching of feed contents (which is what the latter notice is really warning you about). Pull it down and give it a test, see if it resolves the issue for you; if so, great, and if not, let me know what you're seeing.

After a bit more testing if all goes well, I will include this in the next public release of FeedWordPress both here and on the WordPress Plugins SVN repository.

Hope this helps!

@ThatStevensGuy
Copy link
Author

Thank you for looking into this issue. I have tested it finally and it looks like the issues are corrected.

@TheNomad11
Copy link

Thanks for fixing this. So shall we use the code from github? On Wordpress there is still the old version

@talgalili
Copy link
Contributor

@radgeek - could you please update the feedwordpress version on wordpress.org? The current version only supports up to WP 5.5.5.

(if you need help, please add other contributors to this repo / the wordpress account - so that they could help out)

Thanks upfront!

@radgeek radgeek closed this as completed Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants