TypeError: round(): Argument #1 ($num) must be of type int|float, string given in round()

Created on 16 July 2021, over 3 years ago
Updated 30 October 2023, about 1 year ago

Problem/Motivation

Error while trying to bid

Steps to reproduce

Installed auctions module on newly installed Drupal instance and creates first auction node and item, try to make a bid.

Error Message

TypeError: round(): Argument #1 ($num) must be of type int|float, string given in round() (line 20 of /var/www/auctions.girchi.com/web/modules/contrib/auctions/modules/auctions_core/src/AuctionToolsTrait.php)
#0 /var/www/auctions.girchi.com/web/modules/contrib/auctions/modules/auctions_core/src/AuctionToolsTrait.php(20): round()
#1 /var/www/auctions.girchi.com/web/modules/contrib/auctions/modules/auctions_core/src/Form/BiddersForm.php(423): Drupal\auctions_core\Form\BiddersForm->roundCents()
#2 [internal function]: Drupal\auctions_core\Form\BiddersForm->validateForm()
#3 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array()
#4 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Form/FormValidator.php(273): Drupal\Core\Form\FormValidator->executeValidateHandlers()
#5 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm()
#6 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormValidator->validateForm()
#7 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm()
#8 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(219): Drupal\Core\Form\FormBuilder->buildForm()
#9 /var/www/auctions.girchi.com/web/modules/contrib/auctions/auctions.module(130): Drupal\Core\Form\FormBuilder->getForm()
#10 [internal function]: auctions_node_view()
#11 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array()
#12 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(288): Drupal\Core\Extension\ModuleHandler->invokeAll()
#13 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#14 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#15 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#16 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/Renderer.php(786): Drupal\Core\Render\Renderer->doTrustedCallback()
#17 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/Renderer.php(377): Drupal\Core\Render\Renderer->doCallback()
#18 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender()
#19 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(241): Drupal\Core\Render\Renderer->render()
#20 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/Renderer.php(578): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#21 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->executeInRenderContext()
#22 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#23 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#24 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#25 /var/www/auctions.girchi.com/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#26 /var/www/auctions.girchi.com/vendor/symfony/http-kernel/HttpKernel.php(163): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#27 /var/www/auctions.girchi.com/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#28 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#29 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#30 /var/www/auctions.girchi.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#31 /var/www/auctions.girchi.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#32 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#33 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#34 /var/www/auctions.girchi.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#35 /var/www/auctions.girchi.com/web/core/lib/Drupal/Core/DrupalKernel.php(716): Stack\StackedHttpKernel->handle()
#36 /var/www/auctions.girchi.com/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#37 {main}

Additional information

PHP version 8.0.8

Proposed resolution

Typecast string value to float.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇪Georgia otarza

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024