Jump to content

USPS Shipping Module broken in 3.0.14


Guest hafree

Recommended Posts

I recently upgraded from 3.0.12 to 3.0.14, and found that the USPS shipping module was completely broken. The error message recieved when a user attempts to proceed to step 4 of the checkout process is:

Failed to add the package

With debugging enabled, the error messages I saw were:

USPS ERROR: Package array was empty.

or

USPS ERROR: Container not recognised.

Here's the problem: the following files changed from 3.0.13 to 3.0.14, but were not updated in the distribution, except for the version in the headers:

admin\modules\shipping\USPS\index.php

modules\shipping\USPS\calc.php

I was able to fix them by stepping through the changelogs, and now everything works correctly once again. I'm glad it wasn't anything major, but it's a shame that this minor upgrade took countless hours longer than it should have because of sloppy packaging of the new distribution. Hopefully this problem doesn't affect any other modules.

Link to comment
Share on other sites

Guest pbrcaptain

I just upgraded to 3.0.14 and am getting the "USPS ERROR: Package array was empty" error. Since I'm new at this, I'm not sure what you fixed and how you did it. Is there somewhere I can get the right versions of the admin\modules\shipping\USPS\index.php and modules\shipping\USPS\calc.php files? Thanks!!

Link to comment
Share on other sites

Guest pbrcaptain

Here are the correct files for 3.0.14.

index.phpcalc.php

Thank you! That did the trick!!

Just a side note: I did have to go back and make a mod to modules\shipping\USPS\calc.php to fix the USPS zipcode plus problem mentioned elsewhere in this Forum.

Thanks again - I appreciate you responding so quickly!!

Link to comment
Share on other sites

Seems a number of users have the same issue, Mark fixed mine on the customers side, but now I have the same problem on the Admin Side;

"Admin>>Shipping>>Configure>>Edit Settings" ,, gives the same Error

Security Warning

Parsed array keys can not contain illegal characters! Script execution has been halted.

It may be possible to fix this error by deleting your browsers cookies and refresh this page.

I'm cant enable or disable any settings.. any step by step instructions on how to get our cart to work again??

All Products are now defulted as "Free Shipping" and I cant change it or turn it off!!

This is a real BAD thing!

Link to comment
Share on other sites

Thank You CC Support... I guess thats the reason users should use the top up support thats offered ;)

The errors you have are because you haven't updated your store properly. I can see

the code in /modules/shipping/USPS/calc.php as:

if(ereg("service_",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service_","",$moduleKey);




In 3.0.14 it is:




if(ereg("service",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service","",$moduleKey);

The _ is the source of your problems as it is a potentially dangerous charachter in

array keys.

Link to comment
Share on other sites

Guest pbrcaptain

Thank You CC Support... I guess thats the reason users should use the top up support thats offered :dizzy:

The errors you have are because you haven't updated your store properly. I can see

the code in /modules/shipping/USPS/calc.php as:

if(ereg("service_",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service_","",$moduleKey);




In 3.0.14 it is:




if(ereg("service",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service","",$moduleKey);

The _ is the source of your problems as it is a potentially dangerous charachter in

array keys.

Do all 3 of these below need to be edited like this example to solve this problem?

foreach($module as $moduleKey => $moduleValue){

//Changed from "service_" to "service"

if(ereg("service",$moduleKey) && $moduleValue==1){

//Changed from "service_" to "service"

$moduleKey = str_replace("service","",$moduleKey);

// only proceed if module is enabled

//Changed from "service_" to "service"

if($module["service".$moduleKey]==1){

switch($moduleKey) {

Link to comment
Share on other sites

Guest pbrcaptain

Thank You CC Support... I guess thats the reason users should use the top up support thats offered :dizzy:

The errors you have are because you haven't updated your store properly. I can see

the code in /modules/shipping/USPS/calc.php as:

if(ereg("service_",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service_","",$moduleKey);




In 3.0.14 it is:




if(ereg("service",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service","",$moduleKey);

The _ is the source of your problems as it is a potentially dangerous charachter in

array keys.

Do all 3 of these below need to be edited like this example to solve this problem?

foreach($module as $moduleKey => $moduleValue){

//Changed from "service_" to "service"

if(ereg("service",$moduleKey) && $moduleValue==1){

//Changed from "service_" to "service"

$moduleKey = str_replace("service","",$moduleKey);

// only proceed if module is enabled

//Changed from "service_" to "service"

if($module["service".$moduleKey]==1){

switch($moduleKey) {

As a side note: I've made the changes above and tried the last line with "service" and "service_" and I still get the following error on the admin side!! HELP!!!

Security Warning

Parsed array keys can not contain illegal characters! Script execution has been halted.

It may be possible to fix this error by deleting your browsers cookies and refresh this page.

Link to comment
Share on other sites

I honestly wish I knew codeing better.. both Mark at CC3.biz and myself tried about everything and kept chaseing errors from the back end to the front end... I ended up opening a ticket at the support desk and after those fixes didnt work they just went in and fixed it themselves.......(I think they got tired of me)..LOL

in WinMerge the only difference in the calc file was;

		if(ereg("service_",$moduleKey) && $moduleValue==1){

		// 

		}elseif(ereg("service",$moduleKey) && $moduleValue==1){

I dont know what else in any other files they changed,, I'll take a look when I get back from work later today..

Personally the best thing I can think of doing is just paying for the support.. its really cheap considering the time we spend trying to figure this stuff out..

Link to comment
Share on other sites

Thank You CC Support... I guess thats the reason users should use the top up support thats offered ;)

The errors you have are because you haven't updated your store properly. I can see

the code in /modules/shipping/USPS/calc.php as:

if(ereg("service_",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service_","",$moduleKey);




In 3.0.14 it is:




if(ereg("service",$moduleKey) && $moduleValue==1){

		

						$moduleKey = str_replace("service","",$moduleKey);

The _ is the source of your problems as it is a potentially dangerous charachter in

array keys.

Making this change in the calc.php file given above fixed my store, and restoring my original admin/modules/shipping/USPS/index.php file got rid of the security warning message (which, btw, I've been getting in other areas of my store - more or less randomly, as closing my browser and trying again has always fixed the issue [i'm using FF on a Linux machine]).

Thanks guys for pointing out this problem. I rarely sell physical products, so I didn't know about the problem until I saw this thread.

Link to comment
Share on other sites

Thanks guys for pointing out this problem. I rarely sell physical products, so I didn't know about the problem until I saw this thread.

And thanks for your fixes to the USPS shipping module! My store wouldn't be functional without them.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...