Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 9 replies, has 0 voices.

Last updated by Dražen 17 hours, 41 minutes ago.

Assisted by: Dražen.

Author Posts
July 17, 2025 at 9:37 am #17244677

François-Régis Ferry

Contesto del problema:
I am trying to report a bug related to the WPML module version 4.7.6. An error is triggered when clicking '+' on a page with custom fields. The error is: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array. I believe adding a fix in the function match_in_order before array_keys($whitelist) will resolve the issue. The code is located in sitepress-multilingual-cms/classes/settings/class-wpml-tm-serialized-custom-field-package-handler.php. More details can be found in this forum thread: WPML Error Discussion here https://wpml.org/it/forums/topic/uncaught-typeerror-array_keys-argument-1-array-must-be-of-type-array/.

Sintomi:
An error is triggered when clicking '+' on a page with custom fields. The error message is: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array.

Domande:
What causes the Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array?

Is the proposed fix in the function match_in_order (in sitepress-multilingual-cms/classes/settings/class-wpml-tm-serialized-custom-field-package-handler.php) appropriate for resolving this issue?

if ( ! is_array( $whitelist ) ) {
return false;
}
Can you implement it or is there a hook to force the $whitelist variable as an array ? or maybe a setting to configure tat I would have missed ?

July 18, 2025 at 9:35 am #17249358

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for contacting us.

It is very difficult to know what cause it and what might be proper fix.

As I see you have some custom theme / plugins, please check if the issue still happens with them and while using WP default theme.

Let me know how it goes.

Regards,
Drazen

July 21, 2025 at 7:35 am #17253915

François-Régis Ferry

Hello Drazen,
Thank you for your prompt response. I switched to the default WordPress theme, Twenty Twenty-Five, and disabled plugins but I am still experiencing the same issue.
Please let me know how we can proceed from here.
Best regards,

July 21, 2025 at 8:15 am #17254050

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back and testing.

Please share the access details of your website, so I can log in and take a look. Preferblu staging, where I can test same steps as you and do some debugging.

I’m enabling a private message for the following reply.

We have strict policies regarding privacy and access to your information.

Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/


- Please backup the site files and database before providing us access. 

- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.



Thanks,
Drazen

July 22, 2025 at 8:20 am #17258166

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I checked further and it seems issue is related to your custom plugin, as per our support policy we can not support or debug custom code:

- https://wpml.org/purchase/support-policy/

If you can show us issue or WPML bug with simple example code or compatible plugin / themes we can help further, but I am afraid we can not support custom solutions and debug them.

For tasks beyond our standard support, you can get help from certified WPML Contractors.

Hope this makes sense, let me know if any further doubts or questions.

Regards,
Drazen

July 22, 2025 at 8:22 am #17258170

François-Régis Ferry

Hey Dražen thanks for checking but could you give me a bit more details, which plugin(s) according to you is breaking stuff ??
How did you checked?
Thanks

July 22, 2025 at 8:26 am #17258178

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I did not checked, you mentioned issue is with Forms, and as I can see for forms you are using custom plugin Pernod Ricard Forms.

This is not commercial plugin as I can see.

If I have misunderstood the issue, please let me know.

Regards,
Drazen

July 22, 2025 at 8:32 am #17258250

François-Régis Ferry

Oh yes indeed the issue happens when a user wants to translate a form with our custom plugin indeed.
However, from a development point of you maybe you could tell me if there is a hook to make sure the function match_in_order (in sitepress-multilingual-cms/classes/settings/class-wpml-tm-serialized-custom-field-package-handler.php) does not crash when the $whitelist variable is not an array? maybe there is a setting not configured properly ? any workaround ?

Or, will your dev team add such a patch in future version:

if ( ! is_array( $whitelist ) ) {
return false;
}

OR

if ( ! is_array( $whitelist ) ) {
$whitelist = [];
}

Thanks

July 22, 2025 at 9:02 am #17258382

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I checked a bit further, and you might be right, even if it is being caused by custom plugin, it seems we should implement a check to avoid fatal error.

I have escalated ticket to 2nd tier to check and confirm / escalate further if needed.

I will update on any news.

Regards,
Drazen

July 22, 2025 at 10:48 am #17258807

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

we have checked, and some things feel a bit odd. Did you do any adjustment to WPML code or files?

For us to continue and confirm the issue / check further, it would be required to reproduce similar issue on next test site.

The error points to a deeper issue. We could hide it by adding an array check, but the real problem might still be there and could cause translation issues later, so we need to further check.

- hidden link

You can add some simple example code to show us a bug in our code, or you can install your custom plugin and reproduce issue there.

Let us know how it goes.

Regards,
Drazen