Skip to content

is_readable warning when wp cli is called with open_basedir set. Warning should be avoided/suppressed #5957

@headwalluk

Description

@headwalluk

Bug/Warning Report

When calling wp cli like this...

php -d open_basedir=/usr/local/bin:/var/www/example.com /usr/local/bin/wp cron event run --due-now --path=/var/www/example.com/htdocs

we get this:

PHP Warning: is_readable(): open_basedir restriction in effect. File(/var/www) is not within the allowed path(s): (/usr/local/bin:/var/www/example.com) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/utils.php on line 200

This is from the function: find_file_upward()

The site's config file is: /var/www/example.com/htdocs/wp-config.php

If we remove "-d open_basedir=/usr/local/bin:/var/www/example.com" from the call, the warning goes away because find_file_upward() is able to read filesystem data all the way up to the root "/".

Passing open_basedir to PHP when running WP cron jobs (or executing any theme/plugin code) is a good security measure, but our automation scripts are full of unnecessary warnings from the call to is_readable() within find_file_upward().

NOTE: The cron jobs do execute normally - this is just a warning that we would like to see avoided/suppressed.

Thanks

Paul

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions