[wp-trac] [WordPress Trac] #59496: Duotone undefined index/array key warning

WordPress Trac noreply at wordpress.org
Fri Sep 29 09:09:33 UTC 2023


#59496: Duotone undefined index/array key warning
--------------------------+-----------------------------
 Reporter:  jacobcassidy  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 When using a hsl() value to create duotones in theme.json, such as:


 {{{
 "duotone": [
   {
     "colors": ["hsl(0, 0%, 35%)", "hsl(0, 0%, 95%)"],
     "slug": "gray-scale",
     "name": "Gray Scale"
   }
 ]
 }}}

 PHP will throw a warning about an undefined index (in PHP 7.4) or
 undefined array key (in PHP 8+) when a block uses that duotone on a page.

 The exact warning is:
 "PHP Warning:  Undefined array key "" in ../wp-includes/class-wp-
 duotone.php on line 212"

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


More information about the wp-trac mailing list