Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
IPCommerceFan Posted October 11, 2021 Posted October 11, 2021 This post was recognized by Marc! "Thank you" IPCommerceFan was awarded the badge 'Helpful' 4.6.7 - All 3rd party apps/plugins disabled: It looks like there is a ( PHP 8 ) TypeError in applications\nexus\sources\Package\Package.php, in the upgradeDowngrade function, lines 3427 and 3433. TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given (0) #0 /home/user/public_html/applications/nexus/extensions/nexus/Item/UpgradeCharge.php(59): IPS\nexus\_Package->upgradeDowngrade(Object(IPS\nexus\Purchase), Object(IPS\nexus\Package\Product), NULL, true) #1 /home/user/public_html/applications/nexus/sources/Invoice/Invoice.php(1747): IPS\nexus\extensions\nexus\Item\_UpgradeCharge->onPaid(Object(IPS\nexus\Invoice)) #2 /home/user/public_html/applications/nexus/modules/front/checkout/checkout.php(1514): IPS\nexus\_Invoice->markPaid() #3 /home/user/public_html/system/Helpers/Wizard/Wizard.php(181): IPS\nexus\modules\front\checkout\_checkout->_pay(Array) #4 /home/user/public_html/applications/nexus/modules/front/checkout/checkout.php(170): IPS\Helpers\_Wizard->__toString() #5 /home/user/public_html/system/Dispatcher/Controller.php(101): IPS\nexus\modules\front\checkout\_checkout->manage() #6 /home/user/public_html/applications/nexus/modules/front/checkout/checkout.php(57): IPS\Dispatcher\_Controller->execute() #7 /home/user/public_html/system/Dispatcher/Dispatcher.php(153): IPS\nexus\modules\front\checkout\_checkout->execute() #8 /home/user/public_html/index.php(13): IPS\_Dispatcher->run() #9 {main} If the package you are upgrading does not have any Renewal Options, there is nothing to count(), so a TypeError is thrown due to NULL not being countable. Suggest changing this: if ( \count( $renewalOptions ) === 1 ) { $term = array_pop( $renewalOptions ); } elseif ( \count( $renewalOptions ) !== 0 ) { throw new \InvalidArgumentException; } to: if ( \is_countable( $renewalOptions) && \count( $renewalOptions ) === 1 ) { $term = array_pop( $renewalOptions ); } elseif ( \is_countable( $renewalOptions) && \count( $renewalOptions ) !== 0 ) { throw new \InvalidArgumentException; } Confirmed the fix first by adding some renewal options. This worked. Then confirmed by whipping up a plugin that redeclares the whole function with the fix included. It works as it should now. 👍
Marc Posted October 11, 2021 Posted October 11, 2021 Thank you for reporting the bug there, and for the detail you have got to in order to show what is happening. I have added this to our internal bug tracker so that it can be resolved in a future release. IPCommerceFan 1
Solution Marc Posted November 3, 2021 Solution Posted November 3, 2021 This has been resolved in the latest 4.6.8 release. Please upgrade to get the latest release, and let us know if you see any further issues. IPCommerceFan 1
Recommended Posts