[WPML + GiveWP Plugin] Critical error when trying to translate the forms with PHP 8
planned
Diego Pereira
In in \WPML_Element_Translation_Package::add_custom_field_contents in wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php ,
we do:
$custom_fields_values = array_values( array_filter( get_post_meta( $post->ID, $key ) ) );
This iterates over an array of fields. The first field is "title", but there is no such postmeta for that post ID. This makes the fatal error with PHP 8.x and notices with lesser version of PHP
We traced the issue to \Give_DB_Meta::get_meta in wp-content/plugins/give/includes/database/class-give-db-meta.php
This is the exact code lines that trigger the problem:
if ( $this->raw_result ) {
if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
$value = '';
}
The fatal error does not happen if we change this code to
if ( $this->raw_result ) {
if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
$value = array();
}
However, we still have some PHP warnings after that.
Jason Adams
Greetings!
Thank you for bringing this to our attention. It's so helpful to know how this impacts other plugins.
The fact is we know about this. It's _very old_ behavior deep in our legacy code. It's odd and shouldn't be there. I personally looked into resolving it at one point, only to realize it's tricky as various parts of the GiveWP code (and potentially our add-ons) rely on this behavior.
We're currently all-hands-on-deck with getting GiveWP 3.0 out the door and amazing. I'm making a note internally to prioritize this to be resolved by the end of the year. I wish I could promise sooner, but 3.0 is our top priority at the moment, and this could take a bit of time to safely resolve.
Thank you again for letting us know of the impact. We'll address it and update here as soon as we're able.
Angela Blake
Angela Blake
planned
Jason Adams
Greetings!
Thank you for bringing this to our attention. It's so helpful to know how this impacts other plugins.
The fact is we know about this. It's _very old_ behavior deep in our legacy code. It's odd and shouldn't be there. I personally looked into resolving it at one point, only to realize it's tricky as various parts of the GiveWP code (and potentially our add-ons) rely on this behavior.
We're currently all-hands-on-deck with getting GiveWP 3.0 out the door and amazing. I'm making a note internally to prioritize this to be resolved by the end of the year. I wish I could promise sooner, but 3.0 is our top priority at the moment, and this could take a bit of time to safely resolve.
Thank you again for letting us know of the impact. We'll address it and update here as soon as we're able.
Diego Pereira
Hi Jason Adams, thanks for the feedback! Please keep us updated.
Jason Adams
Diego Pereira: You bet! Will do!
Diego Pereira
Hello Jason Adams! Just to follow-up, any updates on this?