[wp-trac] [WordPress Trac] #51062: Twenty Fifteen: PHP Warning: Illegal string offset 'height'
WordPress Trac
noreply at wordpress.org
Tue Sep 15 13:44:01 UTC 2020
#51062: Twenty Fifteen: PHP Warning: Illegal string offset 'height'
---------------------------+----------------------
Reporter: krapanj | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Bundled Theme | Version:
Severity: normal | Resolution: wontfix
Keywords: has-patch | Focuses:
---------------------------+----------------------
Changes (by desrosj):
* status: reopened => closed
* resolution: => wontfix
Comment:
Welcome to Trac @krapanj!
I've been looking this over, here are ways that this issue can be
reproduced:
- A function hooked onto `wp_get_attachment_metadata` that removes the
`width` index.
- The `width` index missing from the `_wp_attachment_metadata` post meta
key for an attachment. This would only happen if the
`wp_generate_attachment_metadata` filter is used to remove the `width`
index.
However, both of these scenarios are, in my opinion, "wrong" ways to alter
an attachment's metadata.
Core documents that `wp_get_attachment_metadata()` returns an array with
`width`, `height`, `file`, `sizes`, and `image_meta` indexes. Any function
hooking into the filters above removing these core indexes will likely
result in problems.
If a check is added for the `height` and `width` indexes here, it would
"mask" the problem, making it extremely difficult to debug what is
happening. Removing any of these indexes is also likely to cause issues
elsewhere in the default WordPress Core behavior. So hiding the notice is
not ideal.
@krapanj it's likely you have a plugin (or potentially code within a child
theme) that is using one of the above hooks to alter the metadata as
described. I recommend trying to find the code responsible and submitting
a ticket to that plugin, or correcting the code in your child theme if
that is your current set up.
If you're unsure how to do that, you can open a ticket in the
[https://wordpress.org/support/forums/ WordPress.org support forums] for
some more guidance. You can reference this issue and my explanation above
to help give the amazing volunteers full context.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51062#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list