-
Hello! Great plugin thank you and I’ve recently moved many sites across from Yoast
I’m using RankMath on one site in combination with the SSH SFTP Updater plugin to allow sftp updates
I’ve seen there were similar reports on here in the past relating to RankMath using the WordPress Filesystem API incorrectly:
https://support.rankmath.com/ticket/ssh-sftp-updater-fatal-error/
https://support.rankmath.com/ticket/fatal-error-ssh-sftp-updater-plugin-cant-install-plugin-rank-math/The author of the SSH SFTP Updater plugin said the following, which I understand to be correct:
This means that [the RankMath] plugin uses the WordPress Filesystem API incorrectly. It attempts to perform filesystem operations (in this case, looking up whether a file exists) without checking that the filesystem link is up. the WordPress Filesystem API has no way of handling that other than throwing a fatal error (the API only defines “yes” or “no” to the answer “does it exist?”, whereas if the link is not there then this is unknown either way), which is what is happening here. Hence, it can only be fixed in the calling plugin with the error.
e.g. Lines 87-90 of
includes/modules/robots-txt/class-robots-txt.php
whereexists
is being called without checking the result ofWordPress::get_filesystem()
first$wp_filesystem = WordPress::get_filesystem(); $public = absint( get_option( 'blog_public' ) ); if ( $wp_filesystem->exists( ABSPATH . 'robots.txt' ) ) {
This same way of trying to use
$wp_filesystem
without checking appears in several places throughout the RankMath codeThere is no Github issue so I presume it’s not on the radar to get fixed yet?
The ticket ‘Critical error caused by incorrect filesystem API use’ is closed to new replies.