[wp-trac] [WordPress Trac] #42670: Symlinked plugin makes plugin_basename function return wrong basename

WordPress Trac noreply at wordpress.org
Wed Sep 27 22:00:09 UTC 2023


#42670: Symlinked plugin makes plugin_basename function return wrong basename
-------------------------------------------------+-------------------------
 Reporter:  sergiienko                           |       Owner:
                                                 |  brianhenryie
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.4
Component:  Plugins                              |     Version:  4.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests needs-testing has-    |     Focuses:
  patch has-testing-info                         |
-------------------------------------------------+-------------------------
Changes (by brianhenryie):

 * keywords:  has-unit-tests needs-testing has-patch => has-unit-tests
     needs-testing has-patch has-testing-info


Comment:

 wp-env test instructions for updated patch:
 https://github.com/BrianHenryIE/a-wp-trac-42670

 Discussion:

 This patch affects `plugin_basename()` and
 `wp_register_plugin_realpath()`. Previously, only plugins whose path and
 realpath differed were recorded in the `global $wp_plugin_paths` array,
 meaning a site which does not use symlinks would have an empty array and
 the `foreach ( $wp_plugin_paths ...` loop in `plugin_basename()` would be
 passed over.

 Now, every time `plugin_basename()` is called, that loop will run on the
 now-populated `$wp_plugin_paths` array.

 Although `plugin_basename()` is widely used, my gut says that will be
 insignificant to performance. I would like someone with better intuition
 to give their opinion.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42670#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list