I could create a user account with username "1", but I couldn't create a account with username "0"... response is: "You must enter a username."

Comments

nyirocsaba’s picture

Status: Needs review » Reviewed & tested by the community

I've replicated the reported issue and after applying the patch it worked fine.

P.S.: We're at the "Drupal Debreceni Napok 2011" ( Drupal Days in Debrecen) and we tested this patch together.

nyirocsaba’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new55.81 KB

This patch really solved this issue, but created other new issues, like:
- on the People ( admin/people ) page "Anonymous" is listed as username instead of "0"

My suggestion is to don't allow to create a user with "0" as name.

robertom’s picture

Status: Needs work » Needs review
StatusFileSize
new2.65 KB

Sorry for my bad english

@nyirocsaba: thanks for pointing that out.

I have rerolled patch with fix for incorrect "Anonymous" username.

My suggestion is to don't allow to create a user with "0" as name.

Yes, this could be an options, but I think the problem is more general...

there are other incorrect use of empty() functions also in other modules (core/contrib).

The "0" string inserted in an input text field of a form, is a correct value, but empty() function don't address that

robertom’s picture

rerolled with username "0" test validation.

nyirocsaba’s picture

Status: Needs review » Needs work
StatusFileSize
new232.09 KB
new42.92 KB

@robertom Y're welcome. Your english is ok.

The "0" string inserted in an input text field of a form, is a correct value, but empty() function don't address that

Y're right and I agree with you. I'm open to do more tests and find out if the patch is causing issues on other places too and I'll let you know if I find anything.

Attached are two screenshots where it's listed "Anonymous" instead of "0":
article-0-username.png - Article author on the front-end
article-0-username-admin.png - Article author on the admin

robertom’s picture

Status: Needs work » Needs review
StatusFileSize
new4.15 KB

I'm open to do more tests and find out if the patch is causing issues on other places too and I'll let you know if I find anything.

Thanks for that.

Attached the re-rolled patch.

I have filled also a similar issue for role: #1107408: explicitly check if role name is filled
and a task addressed to 8.x (but I don't know if this is the correct path) for this type of problem #1107424: take care on use empty() construct (string "0" is an edge case)

wouters_f’s picture

robertom’s picture

Priority: Normal » Minor

Setted priority to minor, because is really minor

Bathie’s picture

Hello, I tested the patch on drupal.7.x-dev and thats works well.

droplet’s picture

Version: 7.x-dev » 8.x-dev
Priority: Minor » Normal
Status: Needs review » Needs work
Issue tags: +Needs backport to D7
damien tournoud’s picture

Status: Needs work » Closed (duplicate)