Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Error: Cannot redeclare zen_set_featured_status()

    On a client site (just upgraded from 1.5.1 to 1.5.5a) I keep getting this error in the logs folder

    [22-Jun-2016 04:18:41 UTC] PHP Fatal error: Cannot redeclare zen_set_featured_status() (previously declared in /home/XXXXXXXX/public_html/includes/functions/featured.php:14) in /home/XXXXXXXX/public_html/includes/functions/featured.php on line 21

    Line 21 in /home/XXXXXXXX/public_html/includes/functions/featured.php only contains the closing bracket }

    Using DTK and searching 1116 files ... for: zen_set_featured_status returns only the stock code in file

    /home/XXXXXXXX/public_html/includes/functions/featured.php

    Line #14 : function zen_set_featured_status($featured_id, $status) {

    Line #41 : zen_set_featured_status($featured->fields['featured_id'], '0');

    Line #67 : zen_set_featured_status($featured->fields['featured_id'], '1');

    Line #83 : zen_set_featured_status($featured->fields['featured_id'], '0');


    No other file (store side) declares that function anywhere - so I am stumped.

    When I first looked at the /logs folder (before the upgrade) the same error appeared more than 100,000 times, obviously the (new) client never checked or cleared the logs folder.....

    The file includes/functions/featured.php has not been modified at all and is still the same as it was when last updated by the devs in 2011,

    Any ideas please?
    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,706
    Plugin Contributions
    12

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Sounds like time for a complete compare. Depending on the method you used to upgrade, it may not take looking at all the files. Perhaps an old mod hanging on?
    A little help with colors.
    myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
    Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.

  3. #3
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by dbltoe View Post
    Sounds like time for a complete compare. Depending on the method you used to upgrade, it may not take looking at all the files. Perhaps an old mod hanging on?
    That would be my next move.

    Used Beyond Compare (prof paid version) for the upgrade and may have missed something old. Mind you, some el-cheapo developer had his/her fingers in this site previously and what old crap I already removed is beyond comprehension.

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by frank18 View Post
    On a client site (just upgraded from 1.5.1 to 1.5.5a) I keep getting this error in the logs folder

    [22-Jun-2016 04:18:41 UTC] PHP Fatal error: Cannot redeclare zen_set_featured_status() (previously declared in /home/XXXXXXXX/public_html/includes/functions/featured.php:14) in /home/XXXXXXXX/public_html/includes/functions/featured.php on line 21
    <snip>
    Any ideas please?
    Yup. The file probably being loaded more than once.

    I can offer a possible solution even though I can't really explain why you would need it but apparently no one else does,

    Two files
    /includes/init_includes/init_special_funcs.php
    and
    admin//includes/init_includes/init_special_funcs.php

    Once contains code that reads
    require(DIR_WS_FUNCTIONS . 'featured.php') ;

    The other
    require(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'featured.php') ;

    My 'theory' is that if the DIR_FS_CATALOG isn't defined (for whatever reason - even though I can't see how the store would function without it) the same 'featured.php' file will be loaded twice. If this were the case though, why is it only this function being redeclared?

    If that theory is incorrect, and it probably is, then my *assumption* that the file is being loaded twice could still be valid, and there is an 'easy' way to prevent the error - even if the cause of the double loading isn't known... Change the 'require(blah blah...)' ; to 'require_once(blah blah...)' ;

    This change, in itself, is quite safe and shouldn't have any ill effects. It doesn't really identify the cause as to why it is needed though. Perhaps there is an 'old/new' file in one of the auto_load folders that is causing it?

    Sorry, no real answer, but a *possible* solution that will effectively 'hide' the problem.

    Cheers
    RodG

  5. #5
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by RodG View Post
    Yup. The file probably being loaded more than once.
    Yep, agree - but why?? That puzzles me, none of my searches in DTK bring up any other file.

    Quote Originally Posted by RodG View Post
    I can offer a possible solution even though I can't really explain why you would need it but apparently no one else does,

    Two files
    /includes/init_includes/init_special_funcs.php
    and
    admin//includes/init_includes/init_special_funcs.php

    Once contains code that reads
    require(DIR_WS_FUNCTIONS . 'featured.php') ;

    The other
    require(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'featured.php') ;

    My 'theory' is that if the DIR_FS_CATALOG isn't defined (for whatever reason - even though I can't see how the store would function without it) the same 'featured.php' file will be loaded twice. If this were the case though, why is it only this function being redeclared?
    Exactly - spot on!!

    Quote Originally Posted by RodG View Post
    If that theory is incorrect, and it probably is, then my *assumption* that the file is being loaded twice could still be valid, and there is an 'easy' way to prevent the error - even if the cause of the double loading isn't known... Change the 'require(blah blah...)' ; to 'require_once(blah blah...)' ;

    This change, in itself, is quite safe and shouldn't have any ill effects. It doesn't really identify the cause as to why it is needed though. Perhaps there is an 'old/new' file in one of the auto_load folders that is causing it?

    Sorry, no real answer, but a *possible* solution that will effectively 'hide' the problem.

    Cheers
    RodG
    Thanks for that Rod, much appreciated indeed. I will try that later and report back.

    As I mentioned earlier in this thread, some el-cheapo 'developer' had a good little fiddle in the file system of that site.... but we'll sort that out!

    Thanks again / Frank
    Last edited by frank18; 23 Jun 2016 at 10:36 AM.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Have you done a search for inclusion of either the applicable FILENAME_ constant or the plain text name or name portion for the same file? I think I came across a similar error situation when a plugin was installed that overwrote one of the core related files and caused this "reload" of the same file and similar errors. Been a few years though since having to deal with that so the details are forgotten. The file compare though should reveal more of what's going on.

    The other thoughts (some of which have already been investigated) was that the function(s) existed in more than one file (renamed file still had an extension of .php) or possibly an edit was performed to the file causing some form of imbalanced curly parenthesis.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by RodG View Post
    Yup. The file probably being loaded more than once.

    I can offer a possible solution even though I can't really explain why you would need it but apparently no one else does,

    Two files
    /includes/init_includes/init_special_funcs.php
    and
    admin//includes/init_includes/init_special_funcs.php

    Once contains code that reads
    require(DIR_WS_FUNCTIONS . 'featured.php') ;

    The other
    require(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'featured.php') ;

    My 'theory' is that if the DIR_FS_CATALOG isn't defined (for whatever reason - even though I can't see how the store would function without it) the same 'featured.php' file will be loaded twice. If this were the case though, why is it only this function being redeclared?

    If that theory is incorrect, and it probably is, then my *assumption* that the file is being loaded twice could still be valid, and there is an 'easy' way to prevent the error - even if the cause of the double loading isn't known... Change the 'require(blah blah...)' ; to 'require_once(blah blah...)' ;

    This change, in itself, is quite safe and shouldn't have any ill effects. It doesn't really identify the cause as to why it is needed though. Perhaps there is an 'old/new' file in one of the auto_load folders that is causing it?

    Sorry, no real answer, but a *possible* solution that will effectively 'hide' the problem.

    Cheers
    RodG
    Yup, that 'fixed' it - temporarily... until I find the real culprit and get rid of it, then remove the _once to put things back to stock files.

    Thanks again / Frank

  8. #8
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by frank18 View Post
    Yup, that 'fixed' it - temporarily... until I find the real culprit and get rid of it, then remove the _once to put things back to stock files.

    Thanks again / Frank
    Spoke too soon - just checked the logs and found another 14 entries of the same nature. Back to the drawing board....

  9. #9
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by frank18 View Post
    Spoke too soon - just checked the logs and found another 14 entries of the same nature. Back to the drawing board....
    Was the admin being accessed or the store at the "time" of generation? Differences/similarities between the two files themselves?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,378
    Plugin Contributions
    9

    Default Re: Error: Cannot redeclare zen_set_featured_status()

    Quote Originally Posted by mc12345678 View Post
    Was the admin being accessed or the store at the "time" of generation? Differences/similarities between the two files themselves?
    Only the store side (as far as I can see it). Anyway, beddies for me now, tomorrow is another day....

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 error: cannot redeclare zen_parse_url()
    By delia in forum General Questions
    Replies: 9
    Last Post: 24 Mar 2015, 08:02 PM
  2. v151 Fatal error: Cannot redeclare zen_create_random_value()
    By IKZAGHET in forum General Questions
    Replies: 1
    Last Post: 17 Jan 2013, 07:43 PM
  3. 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
  4. Fatal error: Cannot redeclare process_product_name
    By nishajh in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 1 Nov 2009, 08:44 AM

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