[wp-trac] [WordPress Trac] #58234: sanitize_title_with_dashes fatal error when query var value is an array in php 8

WordPress Trac noreply at wordpress.org
Thu Dec 26 16:20:49 UTC 2024


#58234: sanitize_title_with_dashes fatal error when query var value is an array in
php 8
-------------------------------------------------+-------------------------
 Reporter:  mouhdev                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Query                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests php80     |     Focuses:
  reporter-feedback                              |
-------------------------------------------------+-------------------------

Comment (by mouhdev):

 @hellofromTonya An alternative way to reproduce this is to put the custom
 post type key as query var (array) and try to load the post type via post
 slug, for example, http://example.com/?custom_post_type[]=test+post

 This will generate a fatal error if the query_var for the registered post
 type is true as default, whether it was a hierarchical post type or not.

 An example of this could be a form to create a custom post or whatever in
 the front end, and having post fields as array keys of custom post type.
 Or it can be a name similarity when parsing the request.

 {{{
 <form method="post" action="">
  <label for="post-title">
   <input type="text" id="post-title" name="custom_post_type[post_title]"
 value="">
  </label>
  <label for="post-title">
   <input type="text" id="post-content"
 name="custom_post_type[post_content]" value="">
  </label>
  <input type="submit" value="Publish">
 </form>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58234#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list