Page 1 of 1

Several sizeof errors

Posted: Mon Oct 13, 2025 4:20 pm
by ArtcoInc
I am installing a new USPS shipping module into my old store, and I am receiving several sizeof() errors.

One is in /includes/classes/shipping.php. I have found that I can address the error if I make this edit:

Code: Select all

//            for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) {
            for ($i=0, $n=sizeof((array)$quotes['methods']); $i<$n; $i++) {
The second is in /checkout_shipping.php. I have found that I can address this error if I make this edit:

Code: Select all

//        for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
        for ($j=0, $n2=sizeof($quotes[$i]['methods'] ?? []); $j<$n2; $j++) {
Does anyone see a problem with either of these two 'fixes'?

1) Yes, these are 'core' changes. I do not have a problem with that.
2) Yes, the *source* of these problems in the new USPS add-on, and I am only treating the symptoms.
3) Yes, this is an old version of Phoenix (1.0.3.0), and these 'problems' MAY have been addressed in newer versions.

Thanks in advance!

Malcolm

Phoenix 1.0.3.0
PHP 7.4.33

Re: Several sizeof errors

Posted: Mon Oct 13, 2025 4:52 pm
by BrockleyJohn
Yes, early phoenix and frozen don't cope with a module returning the quote structure but with method not set and this will stop it whingeing.

It expects the module just to return false. I've implemented something like your edits for a customer before, along with something to show an error message from the module if one is set (e.g. no rates returned, please check your postcode is correct)

My new USPS module works on your core (by choosing the 234BS version) - for my addon, the distinction is drawn for dialog support in admin (jquery v bootstrap)

Re: Several sizeof errors

Posted: Tue Oct 14, 2025 5:00 pm
by ArtcoInc
@BrockleyJohn Thank you!
I purchased your module, and so far, it is working great. A lot more configuration than the old USPS module.

Malcolm

Re: Several sizeof errors

Posted: Mon Jun 08, 2026 9:15 pm
by ceitron
I just purchased the usps module from cartmart.
I have a small issue which I am attempting to resolve.
"Shipping module will not load until API settings are configured. Please install & configure the cartmart_uspsrest module from Modules > Cartmart Addons."
Do I have to edit this module to insert my zip code? I do not see where to add this and normally I do not edit the PHP script.
Hmm, I stuck

Regards,
Steve
ceitron.com/sales

Re: Several sizeof errors

Posted: Tue Jun 09, 2026 8:54 am
by burt
Steve, support for paid-for addons is with the addon provider as only the creator (and the buyer) has the code.
@BrockleyJohn