[wp-trac] [WordPress Trac] #44591: PHP notice if optional argument isn't passed to map_meta_cap()
WordPress Trac
noreply at wordpress.org
Tue Mar 8 03:21:43 UTC 2022
#44591: PHP notice if optional argument isn't passed to map_meta_cap()
--------------------------------------+-----------------------------
Reporter: henry.wright | Owner: SergeyBiryukov
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.0
Component: Users | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Comment (by peterwilsoncc):
In the [https://github.com/WordPress/wordpress-develop/pull/2386 linked
pull request]:
[attachment:"44591-3.diff"] with the following changes:
* version updated to 6.0.0
* removed escaping of translations, core trusts translations
* added unit tests to ensure the affected caps contain `do_not_allow` and
throw a doing it wrong
* fixed `test_taxonomy_meta_capabilities_with_non_existent_terms` to
expect the error
> I'll just suggest that as the guard's code is repetitive if we can wrap
it into a function to respect DRY principe it will be good.
@azouamauriac you're right, it's repetitious. For now I think it's fine to
keep the repetition rather than set up a specific function to wrap
`_doing_it_wrong()`. It's a borderline call, so please feel free to push
back on this if you wish.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44591#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list