Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client reported a bug in WPML version 4.7.6 where an error occurs when clicking the '+' button on a page with custom fields. The error message displayed is: 'Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array.' This issue was linked to the handling of XML configurations for serialized custom fields.
Solution:
We identified that the XML file for the custom forms was misconfigured. Specifically, the 'optinText' field was expected to directly provide a text value for translation, but it was actually stored inside an array. To resolve this, we adjusted the XML configuration to correctly map the 'optinText' field as follows:

<key name="optinText"><br />    <key name="*"></key><br /></key>

After modifying the XML and clearing any existing translation jobs for this form, the error was resolved, and the translation process proceeded without issues. We recommend the client to apply this XML configuration change and verify the results.

If this solution does not apply to your situation, or if it seems outdated, please check the related known issues and confirm that you have the latest versions of themes and plugins installed. If the problem persists, we highly recommend opening a new support ticket at WPML support forum.

100% of people find this useful.

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.

Tagged: 

This topic contains 30 replies, has 0 voices.

Last updated by Dražen 1 month, 2 weeks ago.

Assisted by: Dražen.

Author Posts
July 28, 2025 at 6:21 am #17273768

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks, to be fair I am not sure why. If the plugin is built correctly, WP will recognize it and you can activate it.

If you re-upload correct files, and since this is already taking a while maybe best is to further check with developer who built the plugin, as I have said we will check but we can not guarantee we will debug and fix issue with custom plugin.

Regards,
Drazen

August 12, 2025 at 7:24 am #17312184

François-Régis Ferry

Hello Drazen could you please reset the env, hidden link, my colleague with whom I work had troubles with it
Thanks

August 12, 2025 at 7:28 am #17312190

Dražen
Supporter

Languages: English (English )

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

Hello,

I am afraid I can not, since it is test site / server, this should be only used for simple tests / reproduction, not debugging of the issue and similar so we do not have server access.

I can only provide a new test site that you can use:

- hidden link

Regards,
Drazen

August 12, 2025 at 12:02 pm #17313290

François-Régis Ferry

Thanks a lot Drazen, I'm almost done, I understood the error that my colleague encountered because I replicated it, so please could you provide another sandbox env or reset the current one ?
Thanks

August 12, 2025 at 12:04 pm #17313307

Dražen
Supporter

Languages: English (English )

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

Hello,

sure, here it is:
- hidden link

Regards,
Drazen

August 12, 2025 at 1:39 pm #17313712

François-Régis Ferry

Thanks a lot, but I still have a an issue can you create a new one please ? hope it is the last one, sorry

August 13, 2025 at 7:01 am #17315606

Dražen
Supporter

Languages: English (English )

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

Hello,

sure, but I would suggest first trying on local and making sure you can show us WPML bug with simple example or similar, as I have said we can no debug your whole custom coded plugin. Then you can reproduce same thing on test site.

- hidden link

Regards,
Drazen

August 13, 2025 at 9:17 am #17316176

François-Régis Ferry

Thank you Drazen,
You totally right and it is what I've done without no issue, but in fact I think there was an issue while unzipping the zip archive.
Those testing are already on more than 200 website running fine so I think the issue came from the file manager
I do not want to make you lose your time but I need another one sandbox please, thanks for your comprehension.

August 13, 2025 at 9:46 am #17316325

Dražen
Supporter

Languages: English (English )

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

Hello,

sure, here is another one:

- hidden link

Hope this time you have more luck and it will work.

Let me know how it goes.

Regards,
Drazen

August 13, 2025 at 12:14 pm #17317351

François-Régis Ferry

Drazen, I finally was able to setup the environment for you to replicate the issue
on this page hidden link click on the "+" link as if you wanted to translate the test form, you will get the fatal error that I mentioned at the beginning of my thread, then if you go back you will have the gear icon, but from there we have no way or workaround for translating the post.

So, please advise what we could do, please tell me if your dev team can adapt the wpml plugin or if there is a workaround
Thanks

Capture d’écran 2025-08-13 141012.jpg
August 14, 2025 at 5:36 am #17319635

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks.

Sharing it with our 2nd tier to check further.

Regards,
Drazen

August 19, 2025 at 6:46 am #17329788

Dražen
Supporter

Languages: English (English )

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

Hello,

our 2nd tier checked:

The problem is that you have created an XML file for these custom forms which are slightly mis specified.

On this test site the form has a post ID of 78, and if we check the entry in wp_postmeta for _pr_cdb_form and pass the value into an unserializer then we get a lot of data , so let's focus on the problem field that triggers the error, optinText:

Array
(
  [block_manager] => Array
  (
    [blocks] => Array
    (
    )
  )
  [optinText] => Array
    (
      [0] => <p>I consent to receive news and promotional information.</p>
    )
)

Note that the text is not stored as a direct property of optinText, it is stored in an array.

The plugin has a custom XML file, note how it expects optinText to directly provide the text value for translation, but as noted above it is inside an array.

So that particular part of the XML config should be:

<key name="optinText">
<key name="*"></key>
</key>

We have modified the custom XML, and made sure to delete any existing jobs for this form, then when we tried again to translate we didn't encounter any errors.

Please try.

Regards,
Drazen

August 19, 2025 at 7:38 am #17329885

François-Régis Ferry

Hello Drazen, thanks for your feedback, however when I want to try what you suggested I cannot reach the sandbox anymore whereas I did not do any modification since last time

hidden link

I get the fatal error saying that a file is missing whereas I did not remove it ?

August 19, 2025 at 7:45 am #17329938

Dražen
Supporter

Languages: English (English )

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

Hello,

yes, we also had some issues while we are doing testing, so it is not available anymore.

You will need to check and confirm on your staging / production site.

Regards,
Drazen

August 19, 2025 at 8:15 am #17330140

François-Régis Ferry

Yes no worries, I tried and successfully resolved my issue thanks to your recommendation.
Thanks a lot Drazen, you've been amazing.
All the best