Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2010
    Posts
    1
    Plugin Contributions
    0

    Default Error: cannor redeclare date_diff()

    This is my first store and I am not an expert.

    Followed the installation procedure after a download of the latest version yesterday, got one fatal error message and two deprectaed messages.

    Fatal error: Cannot redeclare date_diff()
    /webshop/admin/includes/functions/general.php on line 3001

    line 3001 is the third line from the bottom (it is an empty line) of this script:

    // compute the days between two dates

    function date_diff($date1, $date2) {

    //$date1 today, or any other day

    //$date2 date to check against



    $d1 = explode("-", $date1);

    $y1 = $d1[0];

    $m1 = $d1[1];

    $d1 = $d1[2];



    $d2 = explode("-", $date2);

    $y2 = $d2[0];

    $m2 = $d2[1];

    $d2 = $d2[2];



    $date1_set = mktime(0,0,0, $m1, $d1, $y1);

    $date2_set = mktime(0,0,0, $m2, $d2, $y2);


    What should the script look like in order to solve this fatal error?

    return(round(($date2_set-$date1_set)/(60*60*24)));

    }

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Error: cannor redeclare date_diff()

    .

    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.

  3. #3
    Join Date
    Apr 2009
    Posts
    47
    Plugin Contributions
    0

    Default Re: Error: cannor redeclare date_diff()

    My system is upgraded from v1.3.8a to v1.3.9f on a php v5.3.2 server, and I keep receveing such error message:

    "PHP Fatal error: Cannot redeclare date_diff() in /shop/includes/functions/functions_general.php on line 1479"


    Line 1479 is:
    " $skipPreg = (defined('OVERRIDE_REPLACE_ACCENTS_WITH_HTMLENTITIES') && OVERRIDE_REPLACE_ACCENTS_WITH_HTMLENTITIES == 'TRUE') ? TRUE : FALSE;"

    I search the whole file, and in line 1454:
    "function zen_date_diff($date1, $date2) {"


    Did I still miss something while upgrading?

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

    Default Re: Error: cannor redeclare date_diff()

    Apparently your server is telling you that the file it's got isn't updated the way you think it is.
    .

    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.

 

 

Similar Threads

  1. v139a Compatibility issue: Fatal error: Cannot redeclare date_diff()
    By jgold723 in forum General Questions
    Replies: 7
    Last Post: 9 Feb 2014, 11:12 PM
  2. v150 Fatal error: Cannot redeclare date_diff()
    By gfdesigns in forum Upgrading to 1.5.x
    Replies: 7
    Last Post: 31 Aug 2012, 08:26 PM
  3. Replies: 7
    Last Post: 3 Jun 2012, 04:37 PM
  4. Replies: 14
    Last Post: 4 May 2012, 10:30 AM
  5. date_diff error with version 3.9f
    By pmsoft in forum General Questions
    Replies: 5
    Last Post: 29 Aug 2011, 10:24 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