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

PHP Warning: Invalid argument supplied for foreach() occuring on Fresh WP Setup #358

Closed
desaiuditd opened this issue Mar 22, 2014 · 2 comments · Fixed by #361
Closed

PHP Warning: Invalid argument supplied for foreach() occuring on Fresh WP Setup #358

desaiuditd opened this issue Mar 22, 2014 · 2 comments · Fixed by #361
Labels

Comments

@desaiuditd
Copy link
Contributor

On Fresh WordPress setup; when there are no records of the Stream activities in the database this PHP warning pops up when you come to Stream Records screen:

PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/rcwp.local.com/htdocs/wp-content/plugins/wp-stream/includes/list-table.php on line 572

Root cause:
In WP_Stream_Date_Interval class, filter_predefined_intervals method is returning false if no records are found; which results in a non-array i.e., $date_interval->intervals being passed to the foreach loop on line 572 of list-table.php

@desaiuditd
Copy link
Contributor Author

Solution would be either change the defination of filter_predefined_intervals to make it return an array value; even if it's empty array or handle this scenario in the list-table.php file on line 572.

Suggestions are welcomed.

@fjarrett

@frankiejarrett
Copy link
Contributor

@desaiuditd Yes, always returning an array value for predefined intervals is the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants