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.

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

Problem: PHP Notice: wpdb::prepare was called incorrectly. The query only expected one placeholder, but an array of multiple placeholders was sent... Solution: https://wpml.org/forums/topic/conflict-with-acf-gallery-get_field/#post-3654221

This topic contains 17 replies, has 2 voices.

Last updated by laurenceC-6 5 months, 3 weeks ago.

Assigned support staff: Bruno Kos.

Author Posts
April 11, 2019 at 11:24 am #3586597

laurenceC-6

I am trying to: look at home page

Link to a page where the issue can be seen: hidden link

I expected to see:no errors

Instead, I got:

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 9]
SELECT wpml_translations.translation_id, wpml_translations.element_id, wpml_translations.language_code, wpml_translations.source_language_code, wpml_translations.trid, wpml_translations.element_type FROM wp_icl_translations wpml_translations JOIN wp_posts p ON wpml_translations.element_id = p.ID AND wpml_translations.element_type = CONCAT('post_', p.post_type) JOIN wp_icl_translations tridt ON tridt.element_type = wpml_translations.element_type AND tridt.trid = wpml_translations.trid WHERE

April 11, 2019 at 11:29 am #3586657

laurenceC-6

when wp debug is turned - warning message

April 11, 2019 at 11:29 am #3586717

laurenceC-6

when wp debug is turned on - warning message

April 11, 2019 at 1:47 pm #3588429

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting WPML support!

Can you tell if you were able to resolve the issue, or it is currently being hidden through PHP display error setting?

If it has not been resolved, can you install Duplicator plugin, create packages so that I could try this on my localhost and possibly escalate further to 2nd tier.

https://wpml.org/faq/provide-supporters-copy-site/

Let me know if this is OK with you.

Regards,
Bruno Kos

April 18, 2019 at 4:59 pm #3640931

laurenceC-6

Just letting you know this is still an open issue so not to close it. The previous support staff has left, w will pick this up after the Easter holiday.

April 19, 2019 at 7:30 am #3643845

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

No worries, the ticket will remain open unless you decide otherwise.

Regards,
Bruno Kos

May 1, 2019 at 5:25 pm #3719113

laurenceC-6

I have a staging site, and I have enabled debug here hidden link so you can see the error

May 2, 2019 at 9:35 am #3723363

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Can I ask you the following then? In order to debug this issue , can you install Duplicator plugin and create package so that I can try this on my localhost and possibly escalate further to 2nd tier?

https://wpml.org/faq/provide-supporters-copy-site/

Let me know if this is OK with you.

If yes, I will need WordPress admin username and password so I could download those packages. I have marked your next reply private so you can safely add this information.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
Please make a full backup of your site before sharing this info!

Regards,
Bruno Kos

May 2, 2019 at 3:22 pm #3725973

laurenceC-6

Hi Brino

The link I sent is a clone of the main live site, so I already made a copy. And with all due respect we need to get it working on our server, so what would be the benefit of you setting it up on your local machine? If it didnt work you go fix it, but if it did work, we will still need to fix it on my server.

The site is over 5Gb with all images. I could exclude them but things may start to break and then its not a straight clone. There are also other integrations to do with statistics and feeds and things, and so I cannot send a duplicate site it may call other integration scripts and mess up business reports and things.

Have you tried it on the staging site I sent?

Thanks

May 3, 2019 at 7:58 am #3731953

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

And with all due respect we need to get it working on our server, so what would be the benefit of you setting it up on your local machine?

Not only our 2nd tier requires us to create Duplicator packages before escalating, but it is not that rare that on different servers issues are not there (e.g. on localhost, without any caching systems or specific configurations in place) which then narrows down a list of possible errors, as it may be only some server configuration or something similar.

The site is over 5Gb with all images. I could exclude them but things may start to break and then its not a straight clone.

Can you create a Duplicator package that would include only theme/plugins and database, and leave out the rest? We will try this in a minimal environment then - (WPML + default WordPress theme only active, no other plugins active). That should also work and may help us debug things, while having a barebones setup only. Since this seems to be sometihing related to database alone, I don't think that the results would be different (I may be wrong, but the time will tell :).

Let me know if you agree.

Regards,
Bruno Kos

May 3, 2019 at 10:06 am #3732865

laurenceC-6

Ok I will try now, but if you Google the SQL error, e.g. hidden link..69i57.206j0j7&sourceid=chrome&ie=UTF-8

then you can see other sites have had this error in the past, here is one with it still live so its not just my own site:

hidden link
hidden link
hidden link

All he others on google have probably disabled WP DEBUG as they dont show but they have done as Google has indexed the error.

May 3, 2019 at 10:17 am #3732981

laurenceC-6

Duplicator does not work, it times out, even with PHP runtime 240s set. The archive file will only be 640Mb, so seems Duplicator is not a suitable backup/archive plugin.

May 3, 2019 at 10:30 am #3733175

laurenceC-6

I have got duplicator, but I think these forums are public? How can I send you a private message with the links and logins.

May 3, 2019 at 1:04 pm #3734447

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

I have marked your next reply private so you can safely add this information.

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

Regards,
Bruno Kos

May 3, 2019 at 3:44 pm #3736273

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

These URLs are absolutely safe - not only these would be stripped from public (it would show something like "hidden link", but this private reply is visible only to WPML support and you as a client, so these would be protected by double.

As for the issue itself, I was able to reproduce this on my localhost and at this point I need you to accept my sincerest apologies for putting you through all this trouble that I see now was not needed. When I saw this in debug.log:

[03-May-2019 15:23:40 UTC] PHP Notice:  wpdb::prepare was called <strong>incorrectly</strong>. The query only expected one placeholder, but an array of multiple placeholders was sent. Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 4.9.0.) in /opt/lampp/htdocs/sqlerror/wp-includes/functions.php on line 466

I realized that it is this error in fact:
https://wpml.org/forums/topic/conflict-with-acf-gallery-get_field/#post-3654221

And that the same workaround fixes your site as well, since it works on my localhost. This fix will be included in a future version of ACF Multilingual, not sure exactly in which one, but until then the workaround will do.

Regards,
Bruno Kos