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

WordPress Trac noreply at wordpress.org
Thu Feb 24 13:21:52 UTC 2022

#55241: Disabling "settings.color.duotone" within theme.json causes fatal error
undefined variable $filter
 Reporter:  aliakseyenkaihar       |       Owner:  audrasjb
     Type:  defect (bug)           |      Status:  reopened
 Priority:  normal                 |   Milestone:  5.9.2
Component:  Themes                 |     Version:  5.9.1
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch fixed-major  |     Focuses:

Comment (by SergeyBiryukov):

 Replying to [comment:16 azouamauriac]:
 > ''1'' and ''2'' do the same thing, but ''1'' looks better than ''2'',
 since ''$i'' was initialize before the loop, what ''2'' doesn't have.
 > But clearly, ''3'' will not give the same result with ''1'', right? that
 what i'm saying.

 Yes, you're right, the behavior is different.

 Looking at the method description, it says: "Converts all filter (duotone)
 presets into SVGs". Before [52791], it looks like it would iterate over
 the whole `$setting_nodes` array, but then only return the last portion of
 presets. So I think the previous logic was incorrect, and the current code
 as of [52791] appears to be correct. That said, it would be great to add
 some unit tests for this :)

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

More information about the wp-trac mailing list