Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2006
    Posts
    105
    Plugin Contributions
    0

    Default ERROR: gv_send Cannot redeclare class httpclient

    Hello,

    Somehow, I messed up a cart that worked very well. The cart in reference is www.gafy.com/zcart. It was built in 1.3.6 and has worked perfectly for over a year.

    I found that customers were confused by the GV emails, so I just removed the embedded GV "click here to redeem" links. I modified the following files in this order:

    -admin/gv_mail.php
    -admin/includes/languages/english/gv_mail.php
    -includes/languages/english/my_template/gv_send.php
    -includes/modules/pages/gv_send
    -includes/templates/my_template/templates/tpl_gv_send_default.php


    Things worked fine after the first two admin mods, but then I checked after the last three "includes" mods, and I got:
    Fatal error: Cannot redeclare class httpclient in /home/xxxx/xxxx/zencart/includes/classes/http_client.php on line 22
    I restored all 5 files to their original files, but I still get the same error.


    I determined that I can eliminate the error if I remove the following line from zencart/includes/modules/pages/gv_send/header_php.php:
    require('includes/classes/http_client.php');
    ...but I assume that's something I shouldn't do?

    I searched for every instance of "httpclient" and it only exists in two other non-related files. I even systematically removed code from the "http_client.php" file, but to no avail. It keeps crashing.

    The rest of the cart works fine, but I guess, fundamentally, I don't understand what my error is trying to tell me (or how to fix it).

    Any thoughts?

    In the meantime, GV sends don't work, and my customers are probably upset! Oh well, LOL!

    -David

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

    Default Re: ERROR: gv_send Cannot redeclare class httpclient

    Commenting out this line from /includes/modules/pages/gv_send/header_php.php should safely provide the relief you need:
    Code:
    require('includes/classes/http_client.php');
    However, that doesn't explain why it's a problem in the first place.

    Go to the Admin->Tools->Developers Toolkit, and in the bottom field enter httpClient and choose All Files-Catalog Only, and click search.

    What files do you see it in? It should only be in the http_client.php script and ups.php and usps.php in their respective folders.
    Perhaps you've mistakenly copied one of those files to another folder that's auto-loading them?

    Repeat the search again with http_client
    .

    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
    Nov 2006
    Posts
    105
    Plugin Contributions
    0

    Default Re: ERROR: gv_send Cannot redeclare class httpclient

    First, thank you for your quick response.

    The 3 files I mentioned above that include references to httpclient are, indeed, the 3 that you identified (the http_client, ups, and usps). Removing the references do nothing.

    Also, if I comment out

    require('includes/classes/http_client.php');
    it will work...but what does that do? What does http_client.php really do?

    I definitely tried everything before I posted the issue, as it is quite troubling. I even looked at every single file in the cart to make sure no other files were modified yesterday...

    It just seems so weird that the files are back in the original state, but I still get the issue.

  4. #4
    Join Date
    Nov 2006
    Posts
    105
    Plugin Contributions
    0

    Default Re: ERROR: gv_send Cannot redeclare class httpclient

    I forget to post the response to your second question about http_client.

    The references appear as follows (only the gv_send was touched):

    /includes/classes/http_client.php

    Line #6 : * @copyright Portions Copyright 2001 Leo West <west_leo AT yahoo-REMOVE- DOT com> Net_HTTP_Client v0.6
    Line #9 : * @version $Id: http_client.php 3047 2006-02-16 21:53:56Z wilt $

    ---------

    /includes/extra_datafiles/music_type_database_names.php

    Line #6 : * @copyright Portions Copyright 2001 Leo West <west_leo AT yahoo-REMOVE- DOT com> Net_HTTP_Client v0.6

    ---------

    /includes/functions/functions_general.php

    Line #750 : } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
    Line #751 : $ip = $_SERVER['HTTP_CLIENT_IP'];
    Line #758 : } elseif (getenv('HTTP_CLIENT_IP')) {
    Line #759 : $ip = getenv('HTTP_CLIENT_IP');

    ---------

    /includes/modules/pages/checkout_shipping/header_php.php

    Line #13 : require(DIR_WS_CLASSES . 'http_client.php');

    ---------

    /includes/modules/pages/gv_send/header_php.php

    Line #17 : //require('includes/classes/http_client.php');

    --------

    /includes/modules/pages/gv_send/header_php1.php

    Line #17 : require('includes/classes/http_client.php');

    ---------

    /includes/modules/shipping_estimator.php

    Line #41 : require('includes/classes/http_client.php'); // shipping in basket

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: ERROR: gv_send Cannot redeclare class httpclient

    Quote Originally Posted by dmfelder View Post
    /includes/modules/pages/gv_send/header_php1.php

    Line #17 : require('includes/classes/http_client.php');
    There's your problem: header_php1.php
    Don't leave temporary files hanging around like that.
    If you want to rename something for backup, DO NOT use .php as the extension, or else any auto-loading systems for various folders will pick them up and process them.
    Try .orig or .bak or .php1, but don't use regular .php for a backup.
    .

    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.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: ERROR: gv_send Cannot redeclare class httpclient

    Quote Originally Posted by dmfelder View Post
    What does http_client.php really do?
    It's used to simulate a web browser when attempting to talk to an external service. Kinda like CURL but not. The USPS and UPS shipping modules use it to get real-time quotes.
    It really shouldn't have ever been part of the gv_send file, but it's harmless to be there.
    .

    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.

  7. #7
    Join Date
    Nov 2006
    Posts
    105
    Plugin Contributions
    0

    Default Re: ERROR: gv_send Cannot redeclare class httpclient

    Outstanding. Thanks. I mean THANKS!

 

 

Similar Threads

  1. v151 Fatal error Cannot redeclare class
    By sasha21 in forum General Questions
    Replies: 5
    Last Post: 21 Jul 2013, 03:21 AM
  2. Fatal error: Cannot redeclare class template_func
    By drseuss in forum General Questions
    Replies: 3
    Last Post: 12 Aug 2009, 07:02 PM
  3. Fatal error: Cannot redeclare class base
    By apovey in forum General Questions
    Replies: 3
    Last Post: 25 Jun 2009, 05:08 AM
  4. Fatal error: Cannot redeclare class template_func
    By jimh3768 in forum General Questions
    Replies: 1
    Last Post: 22 Jan 2008, 05:17 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