Background of the issue:
wp-contentpluginswpml-media-translationclassesclass-wpml-media-attachment-by-url-query.php
line 99
Same issue also in line 163
Which then means the array isn't a list anymore, but an array with non-consecutive keys and you need to either change it to a foreach loop or check with isset in
our 2nd tier checked but we could not reproduce the issue. More details would be necessary. Even when we process the attachments, we always get at least one element in an array and no warnings or errors.
Can you please share more details and steps to reproduce the issue?
I am providing a test site if you can maybe show us the bug there: hidden link
Sorry, but seriously, this is such a basic issue even the most basic static analysis tool catches.
Purely from looking at your code it should be clear what the problem is, I even provided the fix (which somehow got messed up by your markdown/tag handling it seems)
>we always get at least one element in an array
I think you don't understand why your code produces that notice. It's not about whether you get one element or not. It's about whether the array is a list (= array with linear, monotonously increasing int keys) or not. Initially $urls is a list type, but then array_filter can make it into a generic array type where some keys can be missing, which then leads to the notice further down.
thank you for getting back, but as said we are not able to reproduce the same issue or cause such an error message which is why we need your further help.
We would need to confirm the issue before escalating it to our developers.
It would be very helpful if you could provide us a test case or steps to reproduce the issue in a new install and maybe PHP/DB versions.