Results 1 to 5 of 5

Thread: Fatal error: Cannot redeclare class DateTime

  1. #1
    khinester is offline Sugar Community Member
    Join Date
    Oct 2006
    Posts
    34

    Default Fatal error: Cannot redeclare class DateTime

    Hello,
    I am running Gentoo server and have recently updated my PHP, it seems to have broken my SugarCRM.

    When I try to login I get the following error:

    Fatal error: Cannot redeclare class DateTime in /var/www/cms/htdocs/modules/Calendar/DateTime.php on line 29

    Here are the OS details

    PHP 5.2.1-pl3-gentoo (cli) (built: Apr 23 2007 04:30:55)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

    mysql Ver 14.12 Distrib 5.0.24, for pc-linux-gnu (i686) using readline 5.1

    Also, when trying to install the new latest SugarCRM release, I get an unsupported PHP warning.

    Many thanks for your advise

    Norman

  2. #2
    khinester is offline Sugar Community Member
    Join Date
    Oct 2006
    Posts
    34

    Default Re: Fatal error: Cannot redeclare class DateTime

    OK this helped, renamed the class to Datetimes fixed it.

    http://www.sugarcrm.com/forums/showt...&highlight=5.2

  3. #3
    aneesharavindan is offline Junior Member
    Join Date
    Jun 2007
    Posts
    1

    Default Re: Fatal error: Cannot redeclare class DateTime

    Hi Friends,

    This issue came after php version 5.2 , From this version there is exist one class with the same name "DateTime".

    So don't worry my friends. We should welcome all these new improvements with good sense.

    So when we are creating a class , you should consider future development .. So make some difference in your new class names.

    Anyway i had fixed these issues by changing class name "DateTime" to "DateTimeSugar"

    The changes affected the following 5 files,

    modules\Calendar\DateTime.php
    modules\Calendar\Calendar.php
    modules\Calls\Call.php
    modules\Meetings\Meeting.php
    modules\vCals\vCal.php

    Open these files and replace "DateTime" to "DateTimeSugar"


    Thax and Regards,
    aneesh aravindan.

  4. #4
    kathiste is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    16

    Default Re: Fatal error: Cannot redeclare class DateTime

    Quote Originally Posted by aneesharavindan
    Hi Friends,

    Anyway i had fixed these issues by changing class name "DateTime" to "DateTimeSugar"

    The changes affected the following 5 files,

    modules\Calendar\DateTime.php
    modules\Calendar\Calendar.php
    modules\Calls\Call.php
    modules\Meetings\Meeting.php
    modules\vCals\vCal.php

    Open these files and replace "DateTime" to "DateTimeSugar"
    aneesh aravindan.
    I edit DateTime.PHP as suggested:

    DATETIME.PHP
    * This class has been deprecated, the class name classhes with a finction in PHP 5.20. Please use DateTimeUtil instead.
    */
    require_once('modules/Calendar/DateTimeUtil.php');
    class DateTimeSugar extends DateTimeUtil // class DateTime extends DateTimeUtil
    {

    }

    After this, I get the following error message with Calendar module:

    Calendar Notes'; display_calendarnotes($args['calendar']->view,$args); } ?>
    8:00 view,$args); } ?>
    and so on for each line

    An Admin|Repair databases gives messages:

    Repair Database:display
    Print Print Help Help

    Warning: Missing argument 1 for Search::Search(), called in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \modules\Administration\repairDatabase.php on line 72 and defined in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \modules\Search\Search.php on line 28

    Notice: Undefined variable: words in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \modules\Search\Search.php on line 36

    Notice: Undefined index: indices in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \modules\Administration\repairDatabase.php on line 85

    Notice: Undefined index: type in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \include\database\MysqlHelper.php on line 183

    Notice: Undefined index: name in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \include\database\MysqlHelper.php on line 185

    Notice: Undefined index: fields in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \include\database\MysqlHelper.php on line 187

    Notice: Undefined index: fields in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \include\database\MysqlHelper.php on line 190

    Warning: Invalid argument supplied for foreach() in D:\gw\ApacheSoftwareFoundation\Apache\htdocs\sugar \include\database\DBManager.php on line 557
    CREATE TABLE CalendarNotes (id char(36) NOT NULL ,date_entered datetime NOT NULL ,date_modified datetime NOT NULL ,assigned_user_id char(36) NULL ,created_by char(36) NULL ,modified_user_id char(36) NOT NULL ,deleted bool DEFAULT 0 NOT NULL ,type varchar(25) NULL ,date_start date NOT NULL ,date_end date NOT NULL ,name varchar(150) NULL ,date_selection varchar(10) NULL ,duration int DEFAULT '1' NULL ,repeat varchar(5) DEFAULT 'none' NULL ,repeat_times int DEFAULT '1' NULL ,repeat_weekday varchar(4) DEFAULT 'non' NULL ,repeat_monthday int DEFAULT '1' NULL ,repeat_month int DEFAULT '1' NULL , PRIMARY KEY (id)) CHARACTER SET utf8 COLLATE utf8_general_ci

  5. #5
    garydale is offline Sugar Community Member
    Join Date
    Sep 2004
    Posts
    10

    Default Re: Fatal error: Cannot redeclare class DateTime

    Quote Originally Posted by aneesharavindan View Post
    Hi Friends,

    This issue came after php version 5.2 , From this version there is exist one class with the same name "DateTime".

    So don't worry my friends. We should welcome all these new improvements with good sense.

    So when we are creating a class , you should consider future development .. So make some difference in your new class names.

    Anyway i had fixed these issues by changing class name "DateTime" to "DateTimeSugar"

    The changes affected the following 5 files,

    modules\Calendar\DateTime.php
    modules\Calendar\Calendar.php
    modules\Calls\Call.php
    modules\Meetings\Meeting.php
    modules\vCals\vCal.php

    Open these files and replace "DateTime" to "DateTimeSugar"


    Thax and Regards,
    aneesh aravindan.

    I can verify that it works for SugarCRM v2.51 even. Note that you need to do a global search and replace, as well as change the name of the DateTime.php file (at least that's the easiest way).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 2007-11-13, 02:51 PM
  2. New Install - Fatal error: Cannot redeclare class user
    By csiddall in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2007-04-14, 07:14 PM
  3. Replies: 5
    Last Post: 2007-04-12, 01:12 PM
  4. Fatal error: Cannot redeclare class soapclient
    By preginald in forum Web Self Service Portal
    Replies: 0
    Last Post: 2007-04-12, 01:22 AM
  5. DateTime class
    By denis.witt in forum Installation and Upgrade Help
    Replies: 2
    Last Post: 2006-12-06, 08:46 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
  •