[wp-trac] [WordPress Trac] #45236: Cast the result of the `default_content`, `default_title`, and `default_excerpt` filters

WordPress Trac noreply at wordpress.org
Wed Oct 31 02:23:32 UTC 2018


#45236: Cast the result of the `default_content`, `default_title`, and
`default_excerpt` filters
--------------------------+--------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  5.0
Component:  Editor        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+--------------------
 WordPress expects that the result of the `default_*` post filters are
 strings, but PHP isn't very strict about what an empty string is.

 Gutenberg has run into an issue when the filters return null:
 https://github.com/WordPress/gutenberg/issues/11176

 It seems reasonable to expect that the related values within the default
 `$post` object are strings
 ([https://core.trac.wordpress.org/browser/branches/5.0/src/wp-admin/edit-
 form-blocks.php?rev=43840&marks=105-115#L96 ref of where it's used])

 Attached patch does just this, casting to a string to allow Gutenberg to
 receive the empty string that it expects in this case.

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


More information about the wp-trac mailing list