Closed (fixed)
Project:
Domain
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Apr 2010 at 23:33 UTC
Updated:
31 May 2010 at 21:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
agentrickardLooks like we need a case in
domain_batch_validate()for domain_subdomain(). Run each through domain_valid_domain() maybe?You want to try a patch?
Comment #2
agentrickardHere's one.
Comment #3
mikeytown2 commentedI have yet to run the patch but what about the domains that are already in the database? We need some sort of check or update all to be lowercase; I have some uppercase domains currently in my database, it's how I found the bug. Will test later today.
Comment #4
agentrickardThe update function would be pretty simple.
Comment #5
agentrickardOddly, we don't validate for UPPER case right now, except in Domain Alias.
Comment #6
agentrickardRemoving a 'i' from the regex.
Comment #7
agentrickardAnd removing the debug.
Comment #8
agentrickardDoing this might interfere with people transliterating Internationalized Domain Names.
Comment #9
mikeytown2 commentedHave you had any complaints about Domain Alias not working with i18n? I do know that in RFC 819 it says
When doing a query MySQL & case sensitive can cause odd results. Drupal will force the HTTP_HOST to lowercase
http://api.drupal.org/api/function/conf_init/6
So IMHO you should force it to be lowercase since drupal does the same thing to HTTP_HOST
Comment #10
agentrickardRight. I would agree. But IDN splits off from that spec and tries to establish a new one. I think the transliterated versions are still all lower case.
Comment #11
mikeytown2 commentedI don't run any i18n sites so I can't answer this question; but this is what I found on wikipedia.
http://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_T...
http://en.wikipedia.org/wiki/Nameprep
Long story short, looks like it's lowercased.
Comment #12
agentrickardExcellent. I think I may sneak in a domain_validate_alter() hook into this patch as well, just in case.
Comment #13
agentrickardPatch, with update function and alter hook. Looks RTBC to me, then we get 6.x.2.5....
Comment #14
mikeytown2 commentedhook_domain_validate_alter() - Cool!
update works.
admin/build/domain/batch/subdomain when entering in an uppercase domain, validation fails (good) but then all domains get set to red; making it hard to find which domain failed validation (bad).
Other then this interface formapi issue, looks good to me.
Comment #15
mikeytown2 commentedactually thinking about this... for utf8 i18n domains the regex will fail since you only allow
[a-z0-9\.\-:]. The only safe way to test for uppercase IMHO would be a string comparison. Take the original string and see if it matches the mb_strtolower version. Something like thisEDIT: you just might want to stick with strtolower since that is what core uses...
EDIT2: and in this case strtolower is pointless since the regex will catch the uppercase characters.
Comment #16
agentrickardI'm not sure I can fix the form error message. This is an issue with the general batch handling and #TREE.
Where are you suggesting we make the string check change? Probably after this regex?
Comment #17
mikeytown2 commentedThis still will only allow domains with a-zA-Z
http://blog.icann.org/2010/05/idn-cctlds/
The game changed 2 days ago. Only works in safari from what I can tell.
i18n is a different issue. If #TREE can't be fixed then this is RTBC from my point of view.
Comment #18
agentrickardI thought we wanted to remove the case-sensitivity?
Comment #19
agentrickardI can, in fact, indicate which domains fail.
Comment #20
mikeytown2 commentedThats why you got rid of the
iin the regex below.This will now throw an error if $subdomain contains an uppercase character. What I was talking about in #15 (see newly added EDIT2 remark) has to do with non ascii domains. Both versions of this regex will flag them (idn domains) as invalid, but on May 5th (use safari for link in blog) ICANN now allows non ascii domains. This (idn domains) is a different issue, one that Drupal does not currently address AFAIK.
Last patch I tested (#13) fixed the bug addressed in this issue. I can test #19 sometime next week; but if you tested the #TREE indicator and it works, then I think that patch is RTBC.
Thanks for getting this one out :)
Comment #21
agentrickardI think for non-ascii domains, we allow the use of the alter hook.
Comment #22
agentrickardNew patch version, which allows the setting of the variable
domain_allow_non_asciiin settings.php. If TRUE, the ASCII check is bypassed. Moved the lowercase check to its own step and tested successfully with the sample IDN mentioned here.http://blog.icann.org/2010/05/idn-cctlds/
Comment #23
nonsieInitial review - works for batch pages however ASCII validation is bypassed on domain edit form.
Imagine the following scenario:
1. domain_allow_non_ascii is enabled
2. domains are added
3. domain_allow_non_ascii is disabled
4. any edits to domains added in #2 will not fail if the domain name is not changed.
Do we care enough to trigger validation each time domain is updated even when the domain name is not or should it be an item in README.txt?
Also domain add/edit form should indicate if ASCII characters are allowed in the domain name.
Comment #24
agentrickardWe should trigger validation any time example.com is edited. ASCII on/off should be noted.
Comment #25
nonsieI tried removing the name change condition and always calling domain_validate() in domain_form_validate() however this function calls domain_unique_domain() which will return false since there is already a domain with such name. Not sure how to best approach this problem without rewriting big chunks of code or adding an additional parameter to domain_unique_domain()
Comment #26
nonsieThis should do it.
Comment #27
agentrickardNice work, everyone. Documentation added and committed to 6--2.
Comment #28
agentrickardCommitted to D7.