Background of the issue:
I am trying to use WPML installed network-wide, but not all subsites have configured it entirely. When editing pages on one site, I encountered a PHP error. I checked the code and found that on lines 168-169, you are doing: `$settings = apply_filters( 'wpml_setting', false, 'translation-management' ); if ( array_key_exists( 'custom_fields_convert_to_sticky', $settings ) ) {`.
But you should be doing: `$settings = apply_filters( 'wpml_setting', false, 'translation-management' ); if ( !empty($settings) && array_key_exists( 'custom_fields_convert_to_sticky', $settings ) ) {`.
This is because you need to check the response to ensure it is not `false` being returned as you provided by default, or you change the default to an empty array.
Symptoms:
Fatal error: WPML Sticky Links is causing WSOD under certain conditions. PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /wordpress/wp-content/plugins/wpml-sticky-links/classes/custom-fields.php:170.
Questions:
Can you please fix this in core WPML Sticky Links so I no longer have to hotpatch it. Thank you for your amazing work!
So does that mean that the functionality in that is being incorporated elsewhere? I'm happy to remove it from my stack I just want to fully understand why it's still offered for download if it's not really supported?
Well, WordPress has come a long way when it comes to keeping track of the URLs correctly and the plugin is only for cases where the links are changed at a level suggested here:
Fair enough. I do think that it could be fixed given it just requires a check to see if an array is returned or not pass FALSE, because it actually was causing a WSOD on several sites we have.