Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function getRelatedId cannot return NULL value #10107

Closed
JackBuchanan opened this issue Jul 5, 2023 · 1 comment
Closed

Function getRelatedId cannot return NULL value #10107

JackBuchanan opened this issue Jul 5, 2023 · 1 comment
Labels
Area: PHP8 Issues & PRs related to the CRM when using PHP8 Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type:Bug Bugs within the core SuiteCRM codebase Type:Duplicate Issues & PRs which are a duplicate of an existing issue/PR

Comments

@JackBuchanan
Copy link
Contributor

Issue

function getRelatedId in lib/Search/SearchResults.php in unable to return null value due to return types

If function is unable to retrieve related ID then null is returned, but function return type prevent this from happening

Expected Behavior

Function should be allowed to return a NULL value

Actual Behavior

A 500 error is returned

Possible Fix

Allow function to return NULL values

Steps to Reproduce

  1. See line 223 where $relId is set to NULL
  2. See line 208 where the only allowed return type is string

Issue occurs when searching, see error: SuiteCRM\Search\SearchResults::getRelatedId(): Return value must be of type string, null returned

Context

Issue occurs when using basic search

Your Environment

  • SuiteCRM Version used: 7.13.3
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome latest
  • Environment name and version (e.g. MySQL, PHP 7): PHP 8.0
  • Operating System and version (e.g Ubuntu 16.04): 18.04
JackBuchanan added a commit to JackBuchanan/SuiteCRM that referenced this issue Jul 5, 2023
…LL values

Update function return type to ?string so that null and string can be returned
@johnM2401 johnM2401 added Type:Bug Bugs within the core SuiteCRM codebase Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type:Duplicate Issues & PRs which are a duplicate of an existing issue/PR Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Area: PHP8 Issues & PRs related to the CRM when using PHP8 labels Jul 7, 2023
@johnM2401
Copy link
Contributor

Hey!
Thanks for raising this

For reference, looks like this may be a duplicate of: #9516
(please feel free correct me if not)

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: PHP8 Issues & PRs related to the CRM when using PHP8 Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Status:Fix Proposed A issue that has a PR related to it that provides a possible resolution Type:Bug Bugs within the core SuiteCRM codebase Type:Duplicate Issues & PRs which are a duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants