mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
500 error when saving record when audit enabled on numeric field #5038
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#5038
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JackBuchanan on GitHub (Jul 5, 2023).
Issue
500 error is thrown when saving a record if a numeric field is set to auditable and the data change is to or from a null/empty value
Expected Behavior
Users should be able to save no value in a numeric field with audit enabled on that field
Actual Behavior
A 500 error is thrown when saving:
[05-Jul-2023 10:50:32 UTC] PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /var/www/SuiteCRM/include/database/DBManager.php:3093
Stack trace:
#0 /var/www/SuiteCRM/include/database/DBManager.php(3137): DBManager->getDataChanges()
#1 /var/www/SuiteCRM/data/SugarBean.php(6296): DBManager->getAuditDataChanges()
#2 /var/www/SuiteCRM/data/SugarBean.php(2428): SugarBean->auditBean()
#3 /var/www/SuiteCRM/include/SugarObjects/templates/company/Company.php(105): SugarBean->save()
#4 /var/www/SuiteCRM/modules/Accounts/AccountFormBase.php(510): Company->save()
#5 /var/www/SuiteCRM/modules/Accounts/Save.php(55): AccountFormBase->handleSave()
#6 /var/www/SuiteCRM/include/MVC/View/SugarView.php(824): include_once('...')
#7 /var/www/SuiteCRM/include/MVC/View/views/view.classic.php(72): SugarView->includeClassicFile()
#8 /var/www/SuiteCRM/include/MVC/View/SugarView.php(210): ViewClassic->display()
#9 /var/www/SuiteCRM/include/MVC/Controller/SugarController.php(432): SugarView->process()
#10 /var/www/SuiteCRM/include/MVC/Controller/SugarController.php(363): SugarController->processView()
#11 /var/www/SuiteCRM/include/MVC/SugarApplication.php(101): SugarController->execute()
#12 /var/www/SuiteCRM/index.php(51): SugarApplication->execute()
#13 {main}
thrown in /var/www/SuiteCRM/include/database/DBManager.php on line 3093
Possible Fix
Cast values to float before doing math on the values to determine if there has been a data change
Steps to Reproduce
Context
Trying to save record after updating PHP version from 7 -> 8
Your Environment