Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have just installed version 4.7.0 Beta2. I have enabled the locale module. I have imported the french translation file.
When in administer > localization > manage strings if I search for "blog" no string are returned. But if I search for " blog" (with a space in front) more than 30 strings are returned (containing of course the word "blog").
I have done many searches with other words and so far "blog" is the only word which I found having that problem.
Comment | File | Size | Author |
---|---|---|---|
#6 | db_escape.diff | 7.98 KB | Steven |
Comments
Comment #1
Montuelle CreditAttribution: Montuelle commentedIn fact it seems that the problem happens for search words starting with the letter "b". For example "block" or "based".
Comment #2
Montuelle CreditAttribution: Montuelle commentedIt seems that words starting with "f" also have this problem like "follow" or "frequent".
Comment #3
chx CreditAttribution: chx commentedthis search is exact search. Copypaste the exact string.
Comment #4
Montuelle CreditAttribution: Montuelle commentedSorry, but I not sure that I understand your answer.
Do you mean that you are unable to reproduce the problem?
I put quotes around
blog
when reporting my problem, but I don't put quotes in the search field.For example if I enter
Blog
(with B in upper case) in the search field, the search returns 10 results one of these being:If I enter
blog
(with b in upper case) in the search field, the search returns NO strings.If I enter
blog
(with a space in front of the b in upper case) in the search field, the search returns more than 30 results all containing what I am looking for: sentences containing the stringblog
.With Drupal version 4.6, I have not this stange behaviour: searching for
blog
returns all the sentences containingblog
with a lower case. Searching forBlog
returns all the sentences containingBlog
with an upper case.Comment #5
Montuelle CreditAttribution: Montuelle commentedReally sorry, but reading again my previous post, I realize that I did some mistakes and I re-submit it (now fixed; please ignore my previous post).
Sorry, but I am not sure that I understand your answer.
Do you mean that you are unable to reproduce the problem?
I put quotes around
blog
when reporting my problem, but I don't put quotes in the search field.For example if I enter
Blog
(with B in upper case) in the search field, the search returns 10 results one of these being:If I enter
blog
(with b in lower case) in the search field, the search returns NO strings.If I enter
blog
(with a space in front of the b in lower case) in the search field, the search returns more than 30 results all containing what I am looking for: sentences containing the stringblog
.With Drupal version 4.6, I have not this strange behaviour: searching for
blog
returns all the sentences containingblog
with a lower case. Searching forBlog
returns all the sentences containingBlog
with an upper case.Comment #6
Steven CreditAttribution: Steven commentedlocale_string_query() had "%" in its query, instead of "%%". It also used db_escape_string(), which obfuscated the problem and caused the first letter of the string to be interpreted as an sprintf modifier (%s, %d, %f, ...).
Attached a patch which fixes the bug and removes more unnecessary db_escape_string() usage across core.
Comment #7
Steven CreditAttribution: Steven commentedTested again to confirm it doesn't break the cleaned up areas, and fixes the locale search bug.
Committed to HEAD due to overwhelming response.
Comment #8
Montuelle CreditAttribution: Montuelle commentedI have installed the new files from CVS (I am new to this and I don't know yet how to apply a patch). I confirm that the problem which I reported is no longer there.
Thank you very much Steven for this fix.
Comment #9
Dries CreditAttribution: Dries commented