Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / ERROR: gv_send Cannot redeclare class httpclient

ERROR: gv_send Cannot redeclare class httpclient

Locked

Started by dmfelder on 28 Mar 2008, 4:17 PM · Views: 2,283

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
28 Mar 2008, 4:17 PM
#1
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

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

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

28 Mar 2008, 5:26 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

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:```
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.

28 Mar 2008, 6:09 PM
#3
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

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.

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

28 Mar 2008, 6:17 PM
#4
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

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 <[email protected]> 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 <[email protected]> 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

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

28 Mar 2008, 6:34 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: ERROR: gv_send Cannot redeclare class httpclient

dmfelder:

/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.

28 Mar 2008, 6:36 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: ERROR: gv_send Cannot redeclare class httpclient

dmfelder:

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.