[wp-trac] [WordPress Trac] #37645: Changes made to certain is_*() functions generates PHP Notices when arrays or objects are present

WordPress Trac noreply at wordpress.org
Fri Aug 12 16:12:39 UTC 2016


#37645: Changes made to certain is_*() functions generates PHP Notices when arrays
or objects are present
--------------------------+-----------------------------
 Reporter:  Enchiridion   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The patch added by #35902 can generate PHP Array to string conversion
 notices if an array is passed that contains sub-arrays or objects that
 don't implement `__toString()`.

 The supplied patch applies the `strval` conversion taking those special
 conditions into account.

 Functions affected:
 is_attachment()
 is_author()
 is_category()
 is_tag()
 is_page()
 is_single()

 I came across this using plugin I built which adds custom data, in the
 form of an array, to the WP_Post object for my templates to use.  When
 `strval` is run (by post_class() calling is_attachment()) it throws
 notices when it comes across the arrays.

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


More information about the wp-trac mailing list