fix PHP warnings about non-string#6157
Conversation
Stops the generation of these WP_DEBUG messages (https://gist.github.com/cliffordp/42b277d0321c78f59cd2d57faeb0a93d) with the Community Events plugin by Modern Tribe (https://theeventscalendar.com/product/wordpress-community-events/) when Shortcode Embeds is active (https://central.tri.be/issues/72412) and Community Events reCAPTCHA is in use (e.g. anonymous submissions)
georgestephanis
left a comment
There was a problem hiding this comment.
I'm somewhat careful on just short circuiting when input isn't what is expected, fearing we may let something concerning through (at first glance anyways) -- can you give a quick example for why $html wouldn't be a string in this instance, and what we can do to more safely handle that use case?
| foreach ( $regexps as $element => $regexp ) { | ||
| self::$current_element = $element; | ||
|
|
||
| if ( ! is_string( $html ) || ! is_string( $element ) ) { |
There was a problem hiding this comment.
I don't think it's necessary to include the second is_string() here -- $element is the key from the array, so there shouldn't be any issues with it.
|
@georgestephanis, I added and got a lot of these: So it looks like you could drop I'm not really sure where these empty arrays for Here's a copy of the latest version of Community Events (CE) add-on for https://wordpress.org/plugins/the-events-calendar/ -- Here's how to reproduce the issue:
|
|
I'm talking to @cliffordp in .org Slack right now -- this isn't a Jetpack problem, it looks like it's a case of another plugin passing an Closing as it's not ours to fix. |
|
Thanks so much for your help, @georgestephanis!!! |



Stops the generation of these WP_DEBUG messages (https://gist.github.com/cliffordp/42b277d0321c78f59cd2d57faeb0a93d) with the Community Events plugin by Modern Tribe (https://theeventscalendar.com/product/wordpress-community-events/) when Shortcode Embeds is active (https://central.tri.be/issues/72412) and Community Events reCAPTCHA is in use (e.g. anonymous submissions)
Fixes #
Changes proposed in this Pull Request:
Testing instructions:
Proposed changelog entry for your changes: