[wp-trac] [WordPress Trac] #48035: Extra security against warning error for shortcodes

WordPress Trac noreply at wordpress.org
Fri Sep 13 14:28:51 UTC 2019


#48035: Extra security against warning error for shortcodes
---------------------------+-----------------------------
 Reporter:  ignatiusjeroe  |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Shortcodes     |    Version:  5.2.3
 Severity:  minor          |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Function 'shortcode_regex( $tagnames = null )' expects an array. But if
 the users enters a string it triggers an php warning error. It's would be
 better to just type set the parameter to an array. For example:


 function get_shortcode_regex( $tagnames = null ) {
         global $shortcode_tags;

         $tagnames = (array) $tagnames; // string typeset to an array.
 Alternate version: settype( $tagname, 'array' );

         if ( empty( $tagnames ) ) {
 //....more core code

 source: includes/shortcodes.php

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


More information about the wp-trac mailing list