Skip to content

PHP Fatal Error when Saving B2B Company #371

@mpchadwick

Description

@mpchadwick

Prerequisites

Description

When saving a new company in Magento B2B associated with an existing customer as company admin we are seeing this error.

[2024-01-16T18:17:07.645679+00:00] main.CRITICAL: ValueError: bcsub(): Argument #1 ($num1) is not well-formed in /app/REDACTED/vendor/magento/zendframework1/library/Zend/Locale/Math.php:259
Stack trace:
#0 /app/REDACTED/vendor/magento/zendframework1/library/Zend/Locale/Math.php(259): bcsub()
#1 /app/REDACTED/vendor/magento/zendframework1/library/Zend/Locale/Format.php(385): Zend_Locale_Math::Sub()
#2 /app/REDACTED/vendor/magento/zendframework1/library/Zend/Locale/Format.php(662): Zend_Locale_Format::toNumber()
#3 /app/REDACTED/vendor/magento/zendframework1/library/Zend/Filter/NormalizedToLocalized.php(106): Zend_Locale_Format::toFloat()
#4 /app/REDACTED/vendor/magento/framework/Data/Form/Filter/Date.php(69): Zend_Filter_NormalizedToLocalized->filter()
#5 /app/REDACTED/vendor/magento/module-customer/Model/Metadata/Form/AbstractData.php(197): Magento\Framework\Data\Form\Filter\Date->inputFilter()
#6 /app/REDACTED/vendor/magento/module-customer/Model/Metadata/Form/Date.php(20): Magento\Customer\Model\Metadata\Form\AbstractData->_applyInputFilter()
#7 /app/REDACTED/vendor/magento/module-customer/Model/Metadata/Form.php(244): Magento\Customer\Model\Metadata\Form\Date->extractValue()
#8 /app/REDACTED/vendor/magento/module-company/Model/CompanySuperUserGet.php(176): Magento\Customer\Model\Metadata\Form->extractData()
#9 /app/REDACTED/vendor/magento/module-company/Model/CompanySuperUserGet.php(129): Magento\Company\Model\CompanySuperUserGet->extractCustomerData()
#10 /app/REDACTED/vendor/magento/module-company/Controller/Adminhtml/Index/Save.php(233): Magento\Company\Model\CompanySuperUserGet->getUserForCompanyAdmin()
#11 /app/REDACTED/vendor/magento/module-company/Controller/Adminhtml/Index/Save.php(109): Magento\Company\Controller\Adminhtml\Index\Save->saveCompany()
#12 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Company\Controller\Adminhtml\Index\Save->execute()
#13 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->___callParent()
#14 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->Magento\Framework\Interception\{closure}()
#15 /app/REDACTED/generated/code/Magento/Company/Controller/Adminhtml/Index/Save/Interceptor.php(23): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->___callPlugins()
#16 /app/REDACTED/vendor/magento/framework/App/Action/Action.php(111): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->execute()
#17 /app/REDACTED/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#18 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch()
#19 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->___callParent()
#20 /app/REDACTED/app/code/WeltPixel/Backend/Plugin/Utility.php(76): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->Magento\Framework\Interception\{closure}()
#21 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(135): WeltPixel\Backend\Plugin\Utility->aroundDispatch()
#22 /app/REDACTED/app/code/WeltPixel/Backend/Plugin/Utility.php(76): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->Magento\Framework\Interception\{closure}()
#23 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(135): WeltPixel\Backend\Plugin\Utility->aroundDispatch()
#24 /app/REDACTED/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(145): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->Magento\Framework\Interception\{closure}()
#25 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
#26 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->Magento\Framework\Interception\{closure}()
#27 /app/REDACTED/generated/code/Magento/Company/Controller/Adminhtml/Index/Save/Interceptor.php(41): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->___callPlugins()
#28 /app/REDACTED/vendor/magento/framework/App/FrontController.php(245): Magento\Company\Controller\Adminhtml\Index\Save\Interceptor->dispatch()
#29 /app/REDACTED/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#30 /app/REDACTED/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#31 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#32 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#33 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#34 /app/REDACTED/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#35 /app/REDACTED/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#36 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#37 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent()
#38 /app/REDACTED/vendor/msp/adminrestriction/Plugin/AppInterfacePlugin.php(134): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#39 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(135): MSP\AdminRestriction\Plugin\AppInterfacePlugin->aroundLaunch()
#40 /app/REDACTED/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#41 /app/REDACTED/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins()
#42 /app/REDACTED/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#43 /app/REDACTED/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#44 {main} [] []

I've traced it back and determined it is related to the tj_last_sync attribute.

Example from request

company_admin[tj_last_sync]: 2024-01-11 18:57:54

Here's a simple use case that I've whittled it down to

$localeResolver = $di->get('Magento\Framework\Locale\ResolverInterface');
$filter = new \Magento\Framework\Data\Form\Filter\Date('M/d/yy', $localeResolver);
$filter->inputFilter('2024-01-11 18:57:54');

I'm not sure what the fix might be at this point.

Steps to Reproduce

  • Create an individual account on the website
  • Navigate to production admin
  • Create new company, setting this user as the company admin
  • Attempt to save the company

Expected Result

  • Company is saved as expected

Actual Result

  • HTTP 500 with the error provided above

Versions

  • Magento 2.4.5-p3
  • Magento Open Source (fka Magento 2 Community Edition)
  • Adobe Commerce (fka Magento 2 Enterprise Edition)
  • PHP 8.2
  • PHP 8.1
  • PHP 7.4
  • PHP 7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions