Closed Kroc closed 9 years ago
I had totally forgotten about this bug, just throwing it out here, but would it work to add the following along with the function_exists ('transliterator_transliterate')
check?
in_array ('Any-NFKD', $list = transliterator_list_ids ()) &&
in_array ('Any-Latin', $list) &&
in_array ('Latin-ASCII', $list) &&
in_array ('Any-Remove', $list) &&
in_array ('Any-Lower', $list)
I am using just ASCII
here because US-ASCII
was not in my local list of IDs. The separate keywords were not available without the Any-
prefix. Don’t know how much these differences matter for the transliterator_transliterate
string.
We might be able to make this check more compact using some clever array functions. If I can find a server that has this bug I’ll try this out.
Edit:
As a single check, making for less function calls:
count (array_intersect (array ('Any-NFKD', 'Any-Latin', 'Latin-ASCII', 'Any-Remove', 'Any-Lower'), transliterator_list_ids ())) === 5
We also need to check the transliterator_list_ids
function exists too ;)
Very nice solution, this will be rolled in as soon as I get back to NNF. I'm just in the process of setting up a new PC and getting my data back into a working state.
We also need to check the
transliterator_list_ids
function exists too ;)
It might be enough to put this check after the function_exists ('transliterator_transliterate')
. I don’t think you are likely to run into an environment that supports the one without the other. But for completion sake that would of course be possible :smile:
Do note that I haven’t actually tested if this fixes the bug on affected servers. My server is not affected. Someone else will have to test this when it lands.
Over at the forums, Rogue writes in to say the transliterator_list_ids
check seems to be working as expected: disabling transliterator_transliterate
on his set-up where it wasn’t working.
Really happy to see this land, good work everyone who wrote in about this :+1:
Thank you immensely for your work on this (and the UTF-8 handling), I haven't been able to work so diligently since my son has arrived so I grealty appreciate the motivation you bring to the project.
There's a common situation where a user has PHP5.4, but the transliterator libs are not present and the title transliteration fails. We need to check for error and fall back to the <= PHP5.3 methods.
See: http://forum.camendesign.com/how-to-fix-parse-error-syntax-error-unexpected-t_object_operator-in-index-ph+1#6dbuokoy8g1e