[wp-trac] [WordPress Trac] #47678: Modernize/simplify current_user_can()
WordPress Trac
noreply at wordpress.org
Mon Jul 15 23:37:04 UTC 2019
#47678: Modernize/simplify current_user_can()
-------------------------------------+-------------------------------------
Reporter: jrf | Owner: pento
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.3
Component: Role/Capability | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit- | Focuses: performance, coding-
tests commit | standards
-------------------------------------+-------------------------------------
Comment (by jrf):
Replying to [comment:27 peterwilsoncc]:
> I've found WPdirectory does a slightly better job of finding code,
searching `extends [A-Za-z_]*Walker` returns the following:
>
> * Themes: [https://wpdirectory.net/search/01DFVS3VNYJJR948DPTT9APEC1
1496 matches]
> * Plugins: [https://wpdirectory.net/search/01DFVS7CTWSBHN2SYKF5F3BMR9
1127 matches]
>
> As custom walkers are more common in themes, I'm concerned about
breaking BC as themes are less likely to be open-source than plugins. Most
sites run a custom theme.
>
> Custom walkers are required for relatively common features, for example
adding data attributes and IDs to `Walker_Nav_Menu > ul` for use with
generic JavaScript libraries.
Hi Peter, nice! I hadn't thought of searching that way.
I appreciate your concerns and take them seriously, so I've done some more
research.
I've reviewed the code of the themes with > 5000 installs based on the
links you posted, but all of those are ''false positives'', in that -
similar to my previous findings - they just overload the `start_el()`,
`start_lvl()`, `end_el()` and/or `end_lvl()` methods, not the `walk()` or
`paged_walk()` methods.
So, let's look at getting a little more accurate search results and use
this regex `function (?:paged_)?walk\s*\(\s*\$`.
The results are very different then:
* [https://wpdirectory.net/search/01DFVWTFAEQ7SYTES05GZBMFZM Themes]: It
says 11 matches, but is showing only **4** themes, 1 of which is a false
positive (not in a class extending a `*Walker` class)
* [https://wpdirectory.net/search/01DFVWQ74HXF1EPP4K75RNQWJH Plugins]: It
says 277 matches, but is showing only **102** plugins, with ~50% having 0
installs and most of the one which do have installs, including ACF, being
false positives, i.e. in a class not extending a `Walker` class, but,
typically a stand-alone `RWMB_Walker_Select_Tree` class or a class
extending `acf_field`. In reality only **20** of the plugins with more
than 0 installs extends a `*Walker` class.
So 3 out 5.000 themes and some 20 plugins out of 80.000 in the repo.
Of course, this excludes the commercial plugins and themes, as well as
private plugins and themes, but all the same, I do think it's safe to
assume that the numbers will be roughly the same, which means that less
than **0.05%** of plugins and themes will run into this issue.
So, while I appreciate that we should be very careful about this, I think
that we may be overestimating the impact a bit.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47678#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list