[wp-trac] [WordPress Trac] #59206: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in Stack trace:\n#0 [internal function]: img_caption_shortcode()

WordPress Trac noreply at wordpress.org
Fri Aug 25 18:17:31 UTC 2023


#59206: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on
string in Stack trace:\n#0 [internal function]: img_caption_shortcode()
--------------------------+--------------------------------
 Reporter:  maltfield     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.3
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  php-compatibility
--------------------------+--------------------------------

Comment (by aslamdoctor):

 The error appeared whenever there were no arguments passed to the
 [caption] shortcode. Which ended up $attr to be undefined variable.
 So added a condition to check it and initialize it as an empty array if
 not defined.

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


More information about the wp-trac mailing list