Jump to content

Uncaught TypeError: number_format(): Argument #1 ($num) must be of type int|float, WHMCS\View\Formatter\Price given in public_html/vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php


Recommended Posts

Hello,

After updating my WHMCS server PHP version from 7.4 to 8.3, I started getting an error on the “Add Addon to Existing Service” page.

Has anyone experienced this issue or knows a solution? Any help would be greatly appreciated!

Thank you.

URI:
/cart.php?gid=addons&pid=xxx
WHMCS version: 8.13

Whoops\Exception\ErrorException: Uncaught TypeError: number_format(): Argument #1 ($num) must be of type int|float, WHMCS\View\Formatter\Price given in /vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php:0
Stack trace:
#0 /vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php(0): number_format()
#1 /vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php(0): WHMCS\View\Formatter\Price->format()
#2 /vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php(0): WHMCS\View\Formatter\Price->toFull()
#3 /cart.php(0): WHMCS\View\Formatter\Price->__toString()
#4 {main}
thrown in /vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php:0
Stack trace:
#0 /vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\Utility\Error\Run->handleError()
#1 [internal function]: WHMCS\Utility\Error\Run->handleShutdown()
#2 {main}

Link to comment
Share on other sites

Congratulations on your upgrade to 8.13 and PHP8...a very recommended update.

Regarding your error:

This is an expected difference in PHP 7vs 8.x in WHMCS, where float is preferred for pricing values due to they are more suited for multicurrency environments

In this scenario, if I'm understanding your error/trace, the cart template may be incompatible with PHP 8.3. You may also want to verify that the 

/vendor/whmcs/whmcs-foundation/lib/View/Formatter/Price.php

file is also from your active WHMCS version. (I have seen more than one installation where the /vendor or other directories are not managed by their update software, and the clients always forget to manually update these locations!! 

Regardless, you'll want to ensure your response is using the int|float type with the modern system.
 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated