You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating to PHP 8.1.9, I ran into an issue I didn't see on PHP 7x
I have a repeating group that includes cmb2_attached_posts ( https://github.com/CMB2/cmb2-attached-posts/ -- used with minimal hacks for my custom post types and changing verbiage).
I edited /includes/CMB2_Field.php to kick out WHAT the value of $args was if it was a string, and it came back with the ID name (in this case 'show').
I cannot for the life of me see where that's being passed back and muddled, but I did figure out that if I edited _set_field_defaults and moved the check for parse args ABOVE the filter, it corrected it and I didn't have that error anymore.
// Set up blank or default values for empty ones.
$args = wp_parse_args( $args, $defaults );
This maybe is a bug for attached posts, but since the only fix I can find is in the main plugin, it seemed like a more logical place for it.
[20-Jul-2023 00:34:43 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /home/wp-content/plugins/cmb2/includes/CMB2_Field.php:1371
NB: My output actually says 1375 because I had thrown some testing error_log lines in there to figure out what the heck WAS the string in question.
FYI putting my money where my mouth is, this is my full fork of attached posts - CMB2/cmb2-attached-posts#72 - I can't really test this without the fork, since out of the box, you can only use one instance of attached-posts and ... well. Yeah. I'm your local weirdo.
After updating to PHP 8.1.9, I ran into an issue I didn't see on PHP 7x
I have a repeating group that includes cmb2_attached_posts ( https://github.com/CMB2/cmb2-attached-posts/ -- used with minimal hacks for my custom post types and changing verbiage).
https://github.com/LezWatch/lwtv-plugin/blob/production/cpts/characters/cmb2-metaboxes.php#L184
When I use it in a repeating group, I get errors and this is in the log:
I edited
/includes/CMB2_Field.php
to kick out WHAT the value of $args was if it was a string, and it came back with the ID name (in this case 'show').I cannot for the life of me see where that's being passed back and muddled, but I did figure out that if I edited
_set_field_defaults
and moved the check for parse args ABOVE the filter, it corrected it and I didn't have that error anymore.This maybe is a bug for attached posts, but since the only fix I can find is in the main plugin, it seemed like a more logical place for it.
(PS: https://github.com/CMB2/cmb2-attached-posts/ is a wonderful plugin and I would love to see it maintained)
The text was updated successfully, but these errors were encountered: