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: Exception
This topic contains 3 replies, has 1 voice.
Last updated by Andrey 1 month, 1 week ago.
Assisted by: Andrey.
Author | Posts |
---|---|
November 29, 2024 at 11:58 am #16459282 | |
baptisteW-2 |
Background of the issue: Symptoms: Questions: |
November 29, 2024 at 12:01 pm #16459286 | |
baptisteW-2 |
For some reasons, your AI replaced all the code I added into my original answer 🙁 The bug in your code is that you are expecting $urls to have adjacent keys, which is not guaranteed. So, this loop: $urls_count = count( $urls ); for ( $i = 0; $i < $urls_count; $i++ ) { $index = md5( $language . $urls[ $i ] ); $this->setItemToCache( null, 'id_from_guid_cache', $index ); } must be rewritten as such: foreach ( $urls as $url ) { $index = md5( $language . $url ); $this->setItemToCache( null, 'id_from_guid_cache', $index ); } And the same the in second function for $pathes. Otherwise, you will access invalid ids and you will also not access all elements since you will stop early. I have applied this code change and the warning went away. Can you please do this change (or something of the sort to avoid the warning) in your code to fix the warning for everybody? |
November 29, 2024 at 10:10 pm #16461193 | |
Andrey Supporter Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+02:00) |
Thank you for bringing this issue to our attention. While one of my teammates addresses your ticket, I would like to offer some initial steps to follow. Are you using the latest versions of the WPML plugins? Can you replicate the issue on a fresh installation? We need to be able to replicate and confirm the problem in order to make adjustments in WPML. |
December 2, 2024 at 5:26 am #16464169 | |
baptisteW-2 |
Yes, I am using the latest versions of all WPML plugins. I don't have any fresh installation of WordPress to test. |
December 2, 2024 at 1:58 pm #16466563 | |
Andrey Supporter Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+02:00) |
Thank you for your feedback. No worries, I have created a test installation. Would you mind trying to replicate it? You will find the link in the following private message. |
December 3, 2024 at 5:41 am #16469326 | |
baptisteW-2 |
I have done some testing on the test installation, but without having access to the PHP Logs, I do not know whether the warnings are there or not. |
December 3, 2024 at 1:15 pm #16472032 | |
Andrey Supporter Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+02:00) |
Thank you for your feedback. You can use the WP File Manager plugin as an alternative to FTP. I have also activated the debug.log, which will be generated in the wp-content folder if errors or warnings occur. I've attached the screenshots for your reference. |