PHP Warning /class-wp-filesystem-direct.php on line 281

Expected behavior

No warning

Current behavior

PHP error log using CodePotent’s plugin shows a warning. Not sure if it’s important since it’s not an error.

Steps to reproduce

  1. Install ClassicPress and PHPError Log plugin from CodePotent
  2. Activate PHP Error Log plugin
  3. Tools > PHP Error Log
  4. Shows a warning (not an error)

Context

This has zero effect on using my test website. I’m not sure what the warning means and thought it best to pass along. Hopefully it’s the right thing to do.

2 Likes

I haven’t seen this warning, but, generally speaking, warnings are essentially PHP saying, “You shouldn’t be doing this this way, however, I’m not going to stop you from doing it…but, still, you should fix it. Now, carry on.”

Warnings are often an indicator that something which works now may stop working the same way in the future. While warnings aren’t necessarily critical, it’s still a good idea to get the bottom of them.

Looking at the error message, a use of the copy() function seems to be awry. The PHP Error Log plugin doesn’t use this function, but, I did look at line 281 in /wp-admin/includes/class-wp-filesystem-direct.php and find a return false; at line 281…

	public function delete($file, $recursive = false, $type = false) {
		if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
			return false; // <------- This is line 281...
		$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise

I’m looking at ClassicPress 1.1.1; can you confirm that your line 281 reads the same as mine?

If so, it may be either the copy() or the delete() function… The PHP Error Log plugin doesn’t use either of these functions, I suspect the plugin is merely reporting the issue, rather than causing it.

You might scan your files (core/plugins/themes/everything) for the strings delete( and/or copy(, to determine everywhere the functions are used. My guess is that a plugin (or theme) has used one of them incorrectly, so, I’d start with any results you find in the plugins or themes directories.

If you find a plugin using these functions, deactivate it, clear your error log, and see if you can reproduce the error. If you can, deactivate the next one, repeat…and so on… It may take a few tries, but, I suspect this may be the best path forward.

3 Likes

Thank you for the excellent instructions.

Line 281 on my test site cmdtest.pw is the same as yours. I followed your directions and was able to reproduce the warning. It has to do with WP Rollback. I looked at the date of the warning and the time (1:15pm Phoenix time). I was testing Caldera Forms issue that day so I could update my support ticket to them.

What I did was update Caldera to v1.8.7. Then rolled back to v1.8.4 and the error appeared again. It don’t think this appears to be something to be concerned with at all. It only happens rolling back a plugin, not updating a plugin.

Is this your thought too? The warning through me off as it’s pointing to a CP file. I was concerned with all the testing of I’ve done for ET and Caldera I had negatively impacted a file.

Those really were great instructions.

1 Like

Aha! Glad you were able to find it! :smiley: …and thanks for reporting back your findings and method to reproduce the issue. While it’s not a huge concern, I’d probably raise an issue with the wpRollback folks, just to get it on their radar. I suspect ClassicPress folks will use many WP plugins, so, if it’s built for 4.9.x, I’d file an issue (which could fix it for both platforms in one go).

I appreciate that. :slight_smile: Happy to help.

1 Like

My pleasure. I marked your response as the solution. B’c it is in terms of troubleshooting what was occurring.

I will forward the warning to the WP Rollback Support team.

1 Like

Updating this; I think your post more accurately reflects the resolution.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.