[wp-trac] [WordPress Trac] #60352: Fix the architectural design of `/wp-includes/blocks/index.php`

WordPress Trac noreply at wordpress.org
Fri Jan 26 00:15:33 UTC 2024


#60352: Fix the architectural design of `/wp-includes/blocks/index.php`
--------------------------+-------------------------
 Reporter:  azaozz        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  6.5
Component:  General       |    Version:  5.5
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-------------------------
 Follow-up to #55067.

 Generally the `*.php` files in all "include" directories are meant to be
 "included" in other files as the name suggests, not loaded directly. This
 is true for `/wp-includes` too. In addition these include-only files
 should not contain any "loose" PHP code that runs in the global scope,
 only functions and classes. These are pretty simple and easy to follow
 architectural PHP rules that ensure all code works well and avoid some
 exploit vectors.

 However `/wp-includes/blocks/index.php` doesn't seem to be following them,
 similarly to many of the other files in the `blocks` directory. As far as
 I see this should be considered as a PHP code architecture bug and should
 be fixed. The changes should ensure that there is no output or errors when
 that file is loaded directly.

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


More information about the wp-trac mailing list