Code relative filepaths to webroot cause JS 403 error
-
Hi, noticing a strange bug since version 1.8.4. My custom theme code includes the following:
require ‘../../../wp-config.php’;
Before 1.8.4 this would save fine. However, now when I make any edits to the theme file containing this code, it won’t save and shows a Javascript error: Unable to connect to backend. Access denied. Error 403.
After much troubleshooting, I’ve determined the issue is with Filester. These variations work fine:
- require ‘../../my-file.php ## not in web root
- require ‘../../wp-confug.php ## file doesn’t exist and not in web root
However, these all cause the error:
- require ‘../../../wp-config.php ## in web root
- ## require ‘../../../wp-config.php ## even commented code fails b/c it has web root path
- require ‘../../../my-file.php ## in web root
- ## commented code that contains path to web root like this ../../../my-file.php
A hack workaround is to convert the file path to a variable like this:
- $path = ‘../..’;
- $path.= ‘../wp-config.php’;
- require $path;
Please take a look and hopefully you can find the fix. Thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.