WPTT / theme-sniffer

Theme Sniffer plugin using sniffs.
MIT License
270 stars 3 forks source link

Issues with `screenshot_check`. #130

Closed pattonwebz closed 5 years ago

pattonwebz commented 5 years ago

The screenshot check uses a files list that is generated in the required_files_check method and stored in $missing_files. The way that files are added to the array that's in the property is not compatible with the check that is done inside of screenshot_check.

https://github.com/WPTRT/theme-sniffer/blob/98d3b2fdf8370633eb823a19c9ef3127aff4e8d9/src/callback/class-run-sniffer-callback.php#L808

https://github.com/WPTRT/theme-sniffer/blob/98d3b2fdf8370633eb823a19c9ef3127aff4e8d9/src/callback/class-run-sniffer-callback.php#L844

The check looks at root keys for the comparison but the files are added inside an indexed array at root level.

Additionally if the check is modified to correctly compare the key (IE if it is pre-determined there is a missing screenshot) then the method returns null which results in a fatal error later on the code when it is accessed.

https://github.com/WPTRT/theme-sniffer/blob/98d3b2fdf8370633eb823a19c9ef3127aff4e8d9/src/callback/class-run-sniffer-callback.php#L844-L847

https://github.com/WPTRT/theme-sniffer/blob/98d3b2fdf8370633eb823a19c9ef3127aff4e8d9/src/callback/class-run-sniffer-callback.php#L492

dingo-d commented 5 years ago

This was fixed in the PR and can be closed. Thanks!