Skip to content

PHP Warning in class-schedule.php#433

Merged
willmot merged 1 commit into
masterfrom
fix-php-notice-433
Jan 23, 2014
Merged

PHP Warning in class-schedule.php#433
willmot merged 1 commit into
masterfrom
fix-php-notice-433

Conversation

@pdewouters
Copy link
Copy Markdown
Contributor

An intercom user reported the following error

Warning: Invalid argument supplied for foreach() in /var/www/web796/html/www/wp-content/plugins/backupwordpress/classes/class-schedule.php on line 930

I've asked the OP for a var_dump of $haystack as I'd like to understand the contents of the arg that is being passed to the foreach.

Regardless though there are a couple of things we should do to avoid this situation:

  • in L930 check that glob( $haystack . '/*', GLOB_ONLYDIR | GLOB_NOSORT ) returns a valid array before trying to foreach it.
  • in L885 use wp_upload_dir to get the path to the uploads directory (and ensure it actually exists etc.).

@pdewouters
Copy link
Copy Markdown
Contributor

thanks for reporting this. Totally my fault forgetting to use wp_upload_dir

@ghost ghost assigned willmot Jan 23, 2014
@pdewouters
Copy link
Copy Markdown
Contributor

@willmot RMP

willmot added a commit that referenced this pull request Jan 23, 2014
PHP Warning in class-schedule.php
@willmot willmot merged commit 07569fc into master Jan 23, 2014
@willmot willmot deleted the fix-php-notice-433 branch January 23, 2014 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants