Skip Navigation

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.

Elementor users - please update WPML to the latest version to maintain compatibility. More details here - https://wpml.org/changelog/2024/12/wpml-4-6-15-critical-update-for-elementor-sites/
Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+01:00)

Tagged: 

This topic contains 2 replies, has 0 voices.

Last updated by Marcel 14 hours, 33 minutes ago.

Assisted by: Marcel.

Author Posts
December 17, 2024 at 9:40 am #16520555

dominikaK-3

Background of the issue:
I recently updated the WPML String Translation plugin to version 3.2.16, and then to 3.2.17. I looked on that line in code and I saw that you're replacing the "mo" in file path with "l10n.php".

$replaced_mofile = str_replace('mo', 'l10n.php', $mofile);

.
However, this causes not only the .mo extension at the end of file, but also the "mo" in "modemtec" (name of website) to be replaced, leading in invalid path (www.l10n.phpdemtec.com) and warnings.
For me, this works

$replaced_mofile = preg_replace('/.mo$/', '.l10n.php', $mofile);

(replacing .mo at end of the file path) – note that using only .mo in str_replace wouldn't work, as in my path, I have ".mo"demtec.com.

Symptoms:
Warning: file_exists(): open_basedir restriction in effect. File(/www/doc/www.l10n.phpdemtec.com/www/wp-content/plugins/post-carousel/languages/post-carousel-en_US.l10n.php) is not within the allowed path(s): (https://cdn.wpml.org/www/doc/www.modemtec.com) in /www/doc/www.modemtec.com/www/wp-content/plugins/wpml-string-translation/classes/MO/Hooks/LoadTextDomain.php on line 173.

Questions:
Could you fix the str_replace function in your WPML String Translation plugin, so it won't cause the warnings anymore?

December 17, 2024 at 12:33 pm #16521642

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

you can find more information and a temporary workaround here: https://wpml.org/forums/topic/function-fallbackdefaulttranslations-breaks-website-if-domain-contains-string-mo/.

Best Regards,
Marcel

December 18, 2024 at 5:18 pm #16527107

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

(Internal Status Change)