WordPress.org

Ready to get started?Download WordPress

Forums

Countdown Timer
[resolved] Fatal error: Cannot redeclare cmp() (previously declared .... gcal-sidebar (3 posts)

  1. UTLIBOURNE
    Member
    Posted 2 years ago #

    Hello from France

    I've two plugins which use the same cmp() function :

    So when i try to create an event , i get the following message :
    "
    Fatal error: Cannot redeclare cmp() (previously declared in F:\inetpub\vhosts\xxxx.com\httpdocs\ddddd\wp-content\plugins\gcal-sidebar\gcal-sidebar.php:30) in F:\inetpub\vhosts\xxxx.com\httpdocs\ddddd\wp-content\plugins\countdown-timer\fergcorp_countdownTimer.php on line 1022
    "

    In gcal sidebar :
    "
    function cmp($a, $b) {
    if($a['startTime'] > $b['startTime'])
    return 1;
    if($a['startTime'] == $b['startTime'])
    return 0;
    if($a['startTime'] < $b['startTime'])
    return -1;
    }

    In fercop :
    "
    /*Begin sorting events by time*/
    function cmp($adate, $bdate) {
    if($adate < $bdate){
    return -1;
    }else if($adate == $bdate){
    return 0;
    }else{
    return 1;

    "

    Desactivation then activation of the plugin without succes .

    How can i fix this ?

    Many thanks,

    Didier

    http://wordpress.org/extend/plugins/countdown-timer/

  2. UTLIBOURNE
    Member
    Posted 2 years ago #

    Hello,

    I've changed the name - In gcal sidebar - of the function cmp($a, $b) ...
    with :
    function cmpe($a, $b) ,

    and both the plugins work properly .

    Is there a way to check such "identical naming " evrythere in all the php files ?

    Didier

  3. fergbrain
    Member
    Plugin Author

    Posted 1 year ago #

    This is a bug. For various reasons, I thought this should not happen..but PHP is weird like that. It's been fixed as of commit 9b65880968 and will be part of the next release. Sorry for the inconvenience :(

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic