Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

don't load directories #194

Closed
wants to merge 1 commit into from

Conversation

lazardanlucian
Copy link

due to some filesystems nature ( proemintantly VIP ),
require_once was trying to load a directory
I'm not sure why $abs_path was a directory,
albeit from seeing in the code, the redux autoload class puts $abs_path as /uploads/ + /redux/version , so it might start from there,
while this is a temporary fix for wp-admin not to break in some instances, i'm not sure if other issues are present in the plugin.

due to some filesystems nature ( proemintantly VIP ),
require_once was trying to load a directory
I'm not sure why $abs_path was a directory,
albeit from seeing in the code, the redux autoload class puts $abs_path as /uploads/ + /redux/version , so it might start from there,
while this is a temporary fix for wp-admin not to break in some instances, i'm not sure if other issues are present in the plugin.
@lazardanlucian
Copy link
Author

related to #190

@dovy
Copy link
Contributor

dovy commented Feb 15, 2021

@mohammedeisa can you test if this fix doesn't have an impact on other items?

@kprovance
Copy link
Member

kprovance commented Mar 17, 2021

Dovy asked me to peek that this. So, here's the problem. This function is a fallback for get_contents in case wp_filesystem fails. Adding the regex to look for only .php files could, potentially, lock out anyone attempting to read file contents other than a PHP file. I would suggest adding 'is_file' to that if statement first and see if that solves the problem.

kprovance added a commit to svl-studios/redux-framework-4 that referenced this pull request Mar 17, 2021
dovy added a commit that referenced this pull request Mar 18, 2021
@dovy
Copy link
Contributor

dovy commented Mar 18, 2021

@lazardanlucian We've merged a fix into the repo here. Would you mind testing it quickly to see if it works for you on VIP?

@lazardanlucian
Copy link
Author

lazardanlucian commented Mar 18, 2021 via email

@lazardanlucian
Copy link
Author

lazardanlucian commented Mar 18, 2021

@dovy I will not even test your update, https://docs.wpvip.com/technical-references/vip-go-files-system/media-uploads/ clearly states file_exists can return true for directories.

actually i see now that you want to use is_file, I will do a quick test, although reading on the subject,
the norm is to use file_exists && is_file together,

I edited my email response, sorry for my foggy mind,
still I feel like requiring all sorts of files is bad, maybe switch to include if you want

@dovy
Copy link
Contributor

dovy commented Mar 18, 2021

@lazardanlucian There are situations where people will want to require another type of file and read it into a buffer. Like with the raw field.

If you could test it, I'd appreciate it.

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

Successfully merging this pull request may close these issues.

3 participants