Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php error "cannot redeclare"

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #157470
    cybershot
    Participant

    for some reason that I cannot explain, I am getting a white page on my WordPress install that says

    Fatal error: Cannot redeclare column1() (previously declared in /wp-content/themes/RitualHealing/functions.php:615) in /RitualHealing/inc/aq_resizer.php on line 617

    column1() is a shortcode in the functions.php file and the aq_resizer.php is an image resize script that has nothing to do with column1. It says that line 617 of aq_resizer.php and there is only 150 lines of code in that script. How can this be an issue? Why would the two scripts be interfering with eachother? Is there a cause for this that I am not aware of? In php sometimes having a blank space can cause an issue. I was wondering if this could be the same kind of thing?

    #157473
    __
    Participant

    column1() is a shortcode in the functions.php file and the aq_resizer.php

    Well, that’s the reason right there. You cannot use the same name for two different functions. You’ll have to rename one of them.

    Why would the two scripts be interfering with eachother?

    Because you’re running both scripts at the same time.

    #157475
    cybershot
    Participant

    if only it were that simple. This error is a php error. Meaning it’s not my coding The aq_resizer is a resize script that DOES not have column1 in it. There isn’t even that many number of lines. It turned out to be a blank space that was causing the issue. I went into the aq_resizer.php script and added the closing “?>” php tag and tried to delete any invisible spaces and that seems to have fixed it.

    #157485
    __
    Participant

    I read your original post as stating that there were indeed two column1() functions. Sorry for the confusion!

    I’m not sure how whitespace could have been the culprit, here. In fact, leaving the closing ?> off is recommended best practice in php-only files (i.e., any time the file ends inside a php block). I can imagine that there might have been some odd characters that you deleted along with the whitespace… maybe? Still, the error message wouldn’t make much sense. It would be interesting to investigate, if it were reproducible.

    In any case, I’m glad to hear you got it fixed. : )

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.