[wp-trac] [WordPress Trac] #61161: current_user_can fatal error
WordPress Trac
noreply at wordpress.org
Tue May 7 15:48:55 UTC 2024
#61161: current_user_can fatal error
-----------------------------+------------------------------
Reporter: kkmuffme | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Role/Capability | Version: trunk
Severity: major | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by kkmuffme):
I know, but the problem is that this can accidentally make a plugin break
another plugin or WP core alltogether with a fatal error.
e.g. plugin A:
{{{#!php
<?php
function my_cb_a( $value ) {
if ( isset( $_GET['foo'] ) && current_user_can( 'administrator' ) ) {
return 'UTF-8';
}
return $value;
}
add_filter( 'pre_option_blog_charset', 'my_cb_a' );
}}}
plugin B:
{{{#!php
<?php
function my_cb_b() {
$example = get_option( 'blog_charset' );
}
add_action( 'plugins_loaded', 'my_cb_b' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61161#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list