[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 10:56:01 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 azouamauriac):

 @SergeyBiryukov @audrasjb let's take an example:

 {{{#!php
 <?php
 //1
 $i = '';
 $vals = array('a', 'b', 'c');
 foreach ($vals as $key => $value) {
         $i = '';
         $i .= $value;
 }
 var_dump($i);


 //2
 $vals = array('a', 'b', 'c');
 foreach ($vals as $key => $value) {
         $i = '';
         $i .= $value;
 }
 var_dump($i);


 //3
 $j = '';
 $vals = array('a', 'b', 'c');
 foreach ($vals as $key => $value) {
         $j .= $value;
 }
 var_dump($j);

 }}}
 ''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.

 we don't need to remove(move) the ''$filters '' that inside the loop,
 otherwise we will change the default behavior, and may be break something.

 I think the initialisation before the first loop is enough to fix this
 issue, but we don't need to remove the old initialisation inside the loop.

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


More information about the wp-trac mailing list