Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    257
    Plugin Contributions
    6

    Default 157a Fatal error: 1406:Data too long for column 'customers_fax'

    zc157a vanilla is not truncating long data input when creating an account.

    Example fields are "customers_fax" which allows over 130 characters to be input

    then "full_names" for whos_online concatenates first_name + comma + space + last_name for a max length field size of 64 chars without checking length of first_name and last_name. The browser sessions cannot be continued as full_names continuously retries until the browser cache is cleared and the message "WARNING: An Error occurred, please refresh the page and try again."

    env: Zen Cart 157a; Apache 2.4.46; PHP 7.4.9; MySQL 5.7.31; Windows 10
    + inbuilt plugin display log files

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

    Default Re: 157a Fatal error: 1406:Data too long for column 'customers_fax'

    Er, the as-shipped zc157[a] defines the customers_fax field to be varchar(32) in the customers table.

    Perhaps if you post the full contents of the log recorded (obfuscating your admin-directory name, if issued during admin processing), someone could help further.

  3. #3
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    257
    Plugin Contributions
    6

    Default Re: 157a Fatal error: 1406:Data too long for column 'customers_fax'

    zc157a may define customers_fax field to be varchar(32) in the customers table but there is no data field length checking on input of account creation.
    In includes\templates\templates_default\templates\tpl_modules_create_account.php the telephone number is checked but the fax number is not
    HTML Code:
    <fieldset>
    <legend><?php echo TABLE_HEADING_PHONE_FAX_DETAILS; ?></legend>
    <label class="inputLabel" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label>
    <?php echo zen_draw_input_field('telephone', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', '40') . ' id="telephone" placeholder="' . ENTRY_TELEPHONE_NUMBER_TEXT . '"' . ((int)ENTRY_TELEPHONE_MIN_LENGTH > 0 ? ' required' : ''), 'tel'); ?>
    
    <?php
      if (ACCOUNT_FAX_NUMBER == 'true') {
    ?>
    <br class="clearBoth" />
    <label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
    <?php echo zen_draw_input_field('fax', '', 'id="fax" placeholder="' . ENTRY_FAX_NUMBER_TEXT . '"', 'tel'); ?>
    <?php
      }
    ?>
    </fieldset>
    The result is
    HTML Code:
    PHP Fatal error: 1406:Data too long for column 'customers_fax' at row 1 :: INSERT INTO zen_customers (customers_firstname, customers_lastname, customers_email_address, customers_nick, customers_telephone, customers_fax, customers_newsletter, customers_email_format, customers_default_address_id, customers_password, customers_authorization) VALUES ....
    and in the second case field sizes are checked for length on entry and storage to the db but Whos-online does no checking before trying to concatenate two max lenght fields.

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

    Default Re: 157a Fatal error: 1406:Data too long for column 'customers_fax'

    Thanks for the report.

    You can fix your template input by following the telephone pattern in the fax pattern.
    https://github.com/zencart/zencart/c...e8f53ce7edff48
    and whos-online with https://github.com/zencart/zencart/c...d486945ce8af03

    But it definitely begs the question: what sort of fax number is being entered that is 130 chars long?
    .

    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.

  5. #5
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    257
    Plugin Contributions
    6

    Default Re: 157a Fatal error: 1406:Data too long for column 'customers_fax'

    HTML Code:
    But it definitely begs the question: what sort of fax number is being entered that is 130 chars long?
    One that is too long!
    Just testing all input fields to minimise the likelihood of fake accounts and rubbish being entered etc when I move 157a to production.

 

 

Similar Threads

  1. 1406 Data too long for column 'ip_address' at row 1 error
    By OopsIbrickedIT in forum Installing on a Linux/Unix Server
    Replies: 7
    Last Post: 21 Oct 2019, 09:19 PM
  2. v156 PHP Fatal error: 1406:Data too long for column 'ip_address' at row 1
    By mvstudio in forum Upgrading to 1.5.x
    Replies: 14
    Last Post: 27 Jul 2019, 11:39 PM
  3. Replies: 3
    Last Post: 26 Mar 2018, 07:08 AM
  4. Direct Bank Deposit - 1406 Data too long for column 'shipping_method'
    By remoteone in forum Addon Payment Modules
    Replies: 13
    Last Post: 31 Mar 2009, 12:24 AM
  5. 1406 Data too long for column "last_page_url" at row 1
    By time4fishing in forum PayPal Website Payments Pro support
    Replies: 2
    Last Post: 11 Jan 2008, 01:00 AM

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