[wp-trac] [WordPress Trac] #31280: Remove need for numeric keys for admin post screen messages

WordPress Trac noreply at wordpress.org
Tue Feb 10 09:06:49 UTC 2015


#31280: Remove need for numeric keys for admin post screen messages
-------------------------+-----------------------------
 Reporter:  F J Kaiser   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Plugins      |    Version:  4.1
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 By now we can only use absolute integers for post screen messages to
 notify the user of something. This is forced right after the filter that
 allows plugins to add their own messages:

 {{{$messages = apply_filters( 'post_updated_messages', $messages );}}}

 The problem is the following line:

 {{{
 if ( isset($_GET['message']) ) {
         $_GET['message'] = absint( $_GET['message'] );
 }}}

 Now plugin devs can do an arms race with `PHP_INT_MAX -1` as filter
 callback priority and `zzzz_` prefixed callback names and then try to `++`
 their messages until they find a `! isset` place to put their message. Not
 really ideal and as PHP allows mixed arrays, I'd suggest to simply allow
 strings there as well so everyone can just use for e.g. `automattic-
 foobar` as their key to avoid conflicts.

 If there's support for this, I can come up with a patch.

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


More information about the wp-trac mailing list