Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum depth for theme files #87

Closed
stklcode opened this issue Dec 30, 2020 · 2 comments · Fixed by #90
Closed

Maximum depth for theme files #87

stklcode opened this issue Dec 30, 2020 · 2 comments · Fixed by #90
Milestone

Comments

@stklcode
Copy link
Contributor

Side note from a bug report in the WP support forums: https://wordpress.org/support/topic/virus-alert-since-1-4-0/

AntiVirus scans theme files with a maximum depth of 1, i.e. theme base + 1 sublevel:

$files = $theme->get_files( 'php', 1 );

This behavior is not documented, so as a regular user I would expect that all my theme files are scanned. I can only guess the reason why the limit was explicitly set to 1 here.

There are themes that contain PHP files in a deeper hierarchy, like inc/admin/getting-started/getting-started.php (3)

There a several potential changes to apply in this case:

  1. Don't change the behavior and document it.
  2. Raise the limit to a higher value (3, 5, 10, ...)
  3. Make it configurable in plugin options or via hook.
@patrickrobrecht
Copy link
Member

I'd suggest a 4th option: just scan all levels. -1 is for infinite levels (see Code Reference for WP_Theme::get_files()).

@stklcode
Copy link
Contributor Author

I’d call it “option 2a“, but that’s not the point here.

There are some potential pitfalls when scanning directory structures recursively without restrictions (e.g. infinite loops through links on certain filesystems). But I don’t see any real drawbacks here, so I merged the corresponding PR.

@patrickrobrecht patrickrobrecht added this to the 1.4.1 milestone Dec 30, 2020
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 a pull request may close this issue.

2 participants