[wp-trac] [WordPress Trac] #53540: Use $image[0] instead of $image['0'] in media file

WordPress Trac noreply at wordpress.org
Tue Jun 29 04:34:54 UTC 2021


#53540: Use $image[0] instead of $image['0'] in media file
--------------------------+---------------------
 Reporter:  chintan1896   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.9
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------

Comment (by chintan1896):

 Replying to [comment:2 adamsilverstein]:
 > @chintan1896 thanks for the patch. I'm curious why you noticed this
 issue, did it create a warning or error in your system? Or was it more
 something you noticed when reviewing the source code?
 >
 > When using arrays, PHP will
 [https://www.php.net/manual/en/language.types.array.php automatically
 cast] the '0' string to 0 int, so this is more of a cosmetic fix than
 functional, is that right?

 I have noticed when reviewing the source code. Yes, you are right this is
 a cosmetic fix. I have suggested for code consistency. We have used 0 in
 https://github.com/WordPress/WordPress/blob/master/wp-
 includes/media.php#L1218

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


More information about the wp-trac mailing list