Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2007
    Location
    Vancouver, Canada
    Posts
    1,547
    Plugin Contributions
    81

    Default [Bogus, not a bug] zen_validate_email doesn't require a period

    the function zen_validate_email will properly return false if the @ symbol is missing. But it will return true if the period is missing.

    For example, this would be considered a valid email according to that function:

    askjfhsdkh@jkhsdkhsdfhcom

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,474
    Plugin Contributions
    88

    Default Re: zen_validate_email doesn't require a period

    Are there other "non-period" sites other than localhost that should be considered valid?

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: zen_validate_email doesn't require a period

    Quote Originally Posted by lat9 View Post
    Are there other "non-period" sites other than localhost that should be considered valid?
    Yes. Any host on any given local network. IOW: anyhost@localdomain

    localhost and localhost@localdomain are a special case in that they will always resolve to 127.0.0.1

    'localdomain' need not be a literal. It could be 'mynet', 'localnet', 'coca-cola', etc, etc.....

    This means something like bob@coca-cola is a perfectly valid address (albeit, not accessible from the Internet).

    Does this adequately answer the question?

    Cheers
    Rod

  4. #4
    Join Date
    Apr 2007
    Location
    Vancouver, Canada
    Posts
    1,547
    Plugin Contributions
    81

    Default Re: zen_validate_email doesn't require a period

    Why would a customer need to have something emailed to an address that is not accessible via the internet? I understand that you may need that for testing purposes, but in the real world we need a function that will stop people from registering with an invalid email account. Perhaps the Zen Cart devs could have a configuration controller for if the store is being run on a localhost to allow email addresses without periods, otherwise require it.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: zen_validate_email doesn't require a period

    Quote Originally Posted by numinix View Post
    Why would a customer need to have something emailed to an address that is not accessible via the internet?
    They wouldn't, but that has nothing to do with the question "Are there other non-period sites other than localhost that should be considered valid?"

    Quote Originally Posted by numinix View Post
    I understand that you may need that for testing purposes, but in the real world we need a function that will stop people from registering with an invalid email account.
    Easier said than done. Who's to say whether '[email protected]' is a valid email address or not, unless you send a message to that address AND get a valid response. (it could be a black hole or honeypot).

    Quote Originally Posted by numinix View Post
    Perhaps the Zen Cart devs could have a configuration controller for if the store is being run on a localhost to allow email addresses without periods, otherwise require it.
    Actually I am a little surprised that ZenCart doesn't (apparently) check to ensure that a supplied email address adheres to the [email protected] format anyway, and personally I don't see a need to make this any different even for local testing, so in short I'm in agreement with you here, there probably should be a check for the period.

    In theory, this could already be the case, but if the period isn't 'escaped' before testing it will be considered a 'wild card' (It's a *nix thing) which could explain why "askjfhsdkh@jkhsdkhsdfhcom" returns true.

    I (or someone) will need to take a look at the code to see exactly what the situation is.
    It is also possible that the zencart devs don't check for this for some other reason.. (Who knows what goes on inside the mind of a programmer) <grin>

    Cheers
    Rod

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: zen_validate_email doesn't require a period

    Quote Originally Posted by numinix View Post
    the function zen_validate_email will properly return false if the @ symbol is missing. But it will return true if the period is missing.

    For example, this would be considered a valid email according to that function:

    askjfhsdkh@jkhsdkhsdfhcom
    Sorry, I can't replicate this situation you mention, using v1.5.1 code. Both in unit tests and in actual live website tests, such as creating a customer account using askjfhsdkh@jkhsdkhsdfhcom (your suggestion) or missingDot@com (one matching test case in our unit tests) for the email address.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Apr 2007
    Location
    Vancouver, Canada
    Posts
    1,547
    Plugin Contributions
    81

    Default Re: zen_validate_email doesn't require a period

    DrByte,

    I'm not testing by registering. I'm just giving the function zen_validate_email an email address without a period and as long as it has the @ symbol, it seems to validate. It doesn't require the period but it does accept it as a valid character.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: zen_validate_email doesn't require a period

    Here's the unit test that shows the validation to work properly, by simply calling zen_validate_email() with a bunch of predefined patterns good and bad:
    https://github.com/zencart/zencart/b...stTestCase.php
    You can see that yours is the same as the test case of missingDot@com
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Apr 2007
    Location
    Vancouver, Canada
    Posts
    1,547
    Plugin Contributions
    81

    Default Re: zen_validate_email doesn't require a period

    Yes, you are right. Not a bug. Sorry about the false alarm. You can close this topic.

 

 

Similar Threads

  1. Fatal error: Call to undefined function zen_validate_email
    By scot_giant in forum Managing Customers and Orders
    Replies: 1
    Last Post: 7 Jul 2006, 09:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR