[wp-trac] [WordPress Trac] #59751: Invisible PHP 8.2 Error from Unwritable Plugin Folder

WordPress Trac noreply at wordpress.org
Thu Oct 26 16:46:34 UTC 2023


#59751: Invisible PHP 8.2 Error from Unwritable Plugin Folder
--------------------------+-----------------------------
 Reporter:  ispreview     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.3.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59751>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list