latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

PhP Notice while in debug mode

Home Forums Community Forum PhP Notice while in debug mode

This topic contains 4 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years ago.

Topic Author Topic
Posted: Friday Jan 4th, 2013 at 3:46 am #36152
Andaluzo
Username: andaluzo

Hi,

I am in WP Debug Mode since I am looking for some performance issues.

There are popping up a error messages from s2member.

Notice: Undefined variable: cache_needs_updating in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/s2member/includes/classes/cache.inc.php on line 97 

Can anyone pls look into that and give me a solution.

Thanks

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Saturday Jan 5th, 2013 at 8:37 am #36262

In debug mode there will be notices of several things that aren’t critical.

What caching plugin are you using? Do you get that same error using another one?

Posted: Monday Jan 7th, 2013 at 5:48 am #36439
Andaluzo
Username: andaluzo

Dear Christian,

I does not care if they are critical, it is a notice for a bug in the code and that should be fixed.

When I get in my car and there is a light for service, it might not be critical, but I like to get it fixed?

As we move the installation to productive Server now, there is no cache plugin installed yet, but we still receive the following message.

Undefined variable: cache_needs_updating in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/cache.inc.php on line 97 

and additional in the Admin area.

Notice: Undefined index: page in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/admin-notices.inc.php on line 136 
Notice: Undefined index: page in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/admin-notices.inc.php on line 136 
Notice: Undefined index: page in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/admin-notices.inc.php on line 136 
Notice: Undefined index: page in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/admin-notices.inc.php on line 136 
Notice: Undefined index: page in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/admin-notices.inc.php on line 136 
Notice: Undefined index: page in /home/xxxx/htdocs/wordpress/wp-content/plugins/s2member/includes/classes/admin-notices.inc.php on line 136 

Further please advice which Plugin for caching is recommended for s2member.

AGAIN, Thank you guys for your great work!

Posted: Tuesday Jan 8th, 2013 at 5:51 am #36559

I understand what you mean, but when I say they aren’t critical, I really mean they won’t cause trouble. That said, we plan to take care of all of these eventually. We’re doing a complete rewrite of the plugin, and care is being taken to avoid these. Since we’re rewriting the plugin, and these warnings aren’t really important, we haven’t spent more time to clean them up in the current s2Member.

The page index warning is about this line:

[hilite pre_code]
if (!$page || "*" === $page || $pagenow === $page || $_GET["page"] === $page)
[/hilite]

If page were in the GET array and exactly equal to the value of the variable $page, it’d be true in that condition, but it is possible that ‘page’ is not in the GET array at all, which normally means that condition is false, but PHP would still warn that it wasn’t defined at all. To avoid that, it’d have to first check if $_GET[‘page’] is set and then check the value. Try editing that line so it’s like this and see if the warning goes away:

[hilite pre_code]
if (!$page || "*" === $page || $pagenow === $page || (isset($_GET["page"]) && $_GET["page"] === $page))
[/hilite]

About the $cache_needs_updating var not being defined, it’s a similar problem. There are a few conditionals before that line where the variable can be set to true, but if neither one happens, then the var remains undefined. It should be first set as false and then changed to true if needed.

I’ll forward this to Jason so he can comment on it if needed. :)

Posted: Tuesday Jan 8th, 2013 at 5:52 am #36560

Further please advice which Plugin for caching is recommended for s2member.

QuickCache was developed by Jason too, and works very well. http://wordpress.org/extend/plugins/quick-cache/

You can try that, but other caching plugins are good too, just make sure you don’t enable object or database caching, because they’re known to cause problems.

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.