is_dir() open_basedir bug (with fix)
-
Hello, my name is Alduin and I’ll be your dragon today ??
A website I have administrator privileges on is using this plugin, and it clutters the log file with this error:
Got error 'PHP message: PHP Warning:
is_dir(): open_basedir restriction in effect. File(/plugin-templates/login-with-ajax/) is not within the allowed path(s): (...) in /.../wp-content/plugins/login-with-ajax/login-with-ajax.php on line 790;And here is the issue: In
wp-content/plugins/login-with-ajax/login-with-ajax.php
there is this line:$wp_content_folder = path_join( WP_CONTENT_DIR , "/plugin-templates/login-with-ajax/");
path_join()
, as per WordPress docs, checks if$path
(second parameter) is an absolute path – which it is when it starts with a slash. In which case, it just returns$path
. Which is outside open_basedir and, by the way, also never true.So the fix is to locate this line and change it to:
$wp_content_folder = path_join( WP_CONTENT_DIR , "plugin-templates/login-with-ajax/");
Please, can you make it into the main plugin code so it’ll be update-safe?
Thank you :–)
- The topic ‘is_dir() open_basedir bug (with fix)’ is closed to new replies.