[wp-trac] [WordPress Trac] #55241: Disabling "settings.color.duotone" within theme.json causes fatal error undefined variable $filter

WordPress Trac noreply at wordpress.org
Wed Feb 23 18:14:40 UTC 2022


#55241: Disabling "settings.color.duotone" within theme.json causes fatal error
undefined variable $filter
------------------------------+-----------------------------
 Reporter:  aliakseyenkaihar  |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Themes            |    Version:  5.9.1
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 With disabled "duotone" setting within `theme.json` file site crashes
 after 5.9.1 update



 {{{
 // theme.json
 {
    "version": 2,
    "settings": {
         "color": {
             "duotone": null
         }
     }
 }
 }}}


 Error comes here – https://github.com/WordPress/WordPress/blob/master/wp-
 includes/class-wp-theme-json.php#L1597

 As my duotone is empty, it skips definition of `$filters` variable

 Fix: relocate definition of `$filters = ''` before `empty(
 $node['color']['duotone'] )` check

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


More information about the wp-trac mailing list