mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string / float #5222
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#5222
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 @jobst on GitHub (Jul 8, 2024).
Issue
Clicking on "View Roi" within a campaign yields following PHP error
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string / float in SUITECRMINSTALL/modules/Campaigns/RoiDetailView.php:163It is a fatal error (blank page)
Possible Fix
Sorry I do not have the time in the moment
Steps to Reproduce the Issue
Context
Can see ROI.
Version
7.14.4
What browser are you currently using?
Firefox
Browser Version
NOT APPLICABLE
Environment Information
mysqld Ver 8.0.36, PHP 8.2
Operating System and Version
Alma 8.10
@johnM2401 commented on GitHub (Jul 10, 2024):
Hey @jobst !
Thank you for being in touch and raising this!
I've given this a try on a local environment, but I'm afraid I'm not able to replicate as of yet.
I've created and sent a test campaign, with click-through events registered

I then access its "View ROI" page, and it renders:
This environment is:
PHP8.2.11 / Mysql8 / SuiteCRM 7.14.4 / Firefox 113.02
Have I perhaps missed any pertinent information that might help replicate?
ie:
Does this happen for a specific Campaign Type, or when certain actions/results are performed for a Campaign?
Does this happen when you enter specific values in the campaign's "Actual Cost" field? (ie: Custom Currencies / text values e/etc)
Thanks again!
@jobst commented on GitHub (Jul 11, 2024):
Ok, I looked at the code, the error has to do what INPUT of the fields is provided.
The code clearly checks for the LINKS to be greater ZERO to omit division by zero.
However it does NOT check the inputs for a VALID number like !empty or "q" (i.e. MUST be a number and NOT empty).
For this (and many other) campaigns we did not place "actual costs" which leads to a FATAL error when using PHP8,2.
Looking at other places in the code of RoiDetailView.php I see there are other spots where the input is not checked or not given a default value like "0" (zero).
For a person like me I can figure this out but IMHO a normal user should get a "you cant do that" and not a blank page.
@johnM2401 commented on GitHub (Jul 15, 2024):
Hey @jobst !
Thank you for that additional information.
Interestingly, I'm unable to replicate when either either text or empty values, (ie: don't touch the fields at all), into the fields when creating a Campaign.
However, if I set the values to "null" in the db directly, I can indeed replicate the whitescreen error.
I'll mark this with a priority now that I can confirm.
Thank you again for your issue and your time!