Make WordPress Core

Opened 16 months ago

Closed 7 months ago

#59751 closed defect (bug) (duplicate)

Invisible PHP 8.2 Error from Unwritable Plugin Folder

Reported by: ispreview's profile ispreview Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.3.2
Component: Administration Keywords:
Focuses: Cc:

Description

Recently I've found that, when enabling PHP 8.2 support on WordPress 6.3.2 (it was present in earlier versions too), I get that quirky problem where a blank space appears between the WordPress admin menu and the bar. This sort of issue:

https://wordpress.stackexchange.com/questions/372897/how-to-fix-the-admin-menu-margin-top-bug-in-wordpress-5-5

Upon inspection of the CSS/HTML code I found that the ".php-error #adminmenuback" class was injecting an extra margin due to a hidden error. I enabled debug logging to a file, but that did not expose the error. Eventually I was able to identify the error by adding this into the admin-header.php file need the error block (around line 200 ish):

echo "<pre>error_last\n"; print_r( error_get_last() ); echo "</pre>\n"; die();

The output produced highlighted that, as part of my plugin testing, I had left a mirror copy of one of my plugins in the plugin's folder - this was protected by a CHMOD 0 to prevent it being accessible. So having a folder inside plugins that cannot be read seems to cause it.

error_last
Array
(
    [type] => 2
    [message] => opendir(/wp-content/plugins/nextgen-galleryBAK): Failed to open directory: Permission denied
    [file] => /wp-admin/includes/plugin.php
    [line] => 304
)

I was thus able to resolve the hidden error in the admincp Dashboard by simply removing that unwritable folder. But I thought it might be worth reporting this, as I've never had such a bug before PHP8.2, and it took time to discover the cause. This also makes plugin testing between versions a bit more tedious, as now I have to keep my test plugin edits outside the plugin folder and can't simply chop and change using CHMOD permissions (crude I know, but it did work, until now).

Change History (2)

#1 @swissspidy
16 months ago

  • Keywords close added

Looks like a duplicate of #51383, because on that line there is an @opendir() call.

#2 @desrosj
7 months ago

  • Component changed from General to Administration
  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #51383.

Note: See TracTickets for help on using tickets.