Suitecrm: Illegal string offset '' in aow_utils.php on line 532

Created on 16 Sep 2019  路  6Comments  路  Source: salesagility/SuiteCRM

Issue

It looks like this code is from all the way back to the initial commit, so it's from SugarCRM.

It has a comment that says Bug 22730: make sure all enums have the ability to select blank as the default value., idk if we can learn anything from finding that bug in the old SugarCRM bug tracker?

Expected Behavior

No PHP warnings in the logs.

Actual Behavior

I get an illegal offset warning:

PHP Warning:  Illegal string offset '' in /Users/connorshea/code/sites/SuiteCRM/modules/AOW_WorkFlow/aow_utils.php on line 532

https://github.com/salesagility/SuiteCRM/blob/1d2acdf7b0c7375557b93f38475b2881343f920f/modules/AOW_WorkFlow/aow_utils.php#L532

Possible Fix

Potentially remove the code, though I suspect that could break enums having a blank field as an option? Can we rename the key to 'blank' or something?

Steps to Reproduce

  1. Create a report
  2. View the report page
  3. See the dropdowns for the parameters, this is what ours looks like:
    Screen Shot 2019-09-16 at 12 01 50 PM
  4. Check the logs and see this error.

Context

Warnings are annoying :)

Your Environment

  • SuiteCRM Version used: 7.10.19
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Firefox 69
  • Environment name and version (e.g. MySQL, PHP 7): MySQL 5.7, PHP 7.2
  • Operating System and version (e.g Ubuntu 16.04): macOS Mojave 10.14.6
Moderate Fix Proposed Bug

Most helpful comment

Oh, nevermind I looked at that thread you linked, I hadn't realized there were commands in that thread for determining the most common notices :D

The top few notices are the ones I've fixed in the last few days, that plus the mPDF fix (#7111) which should probably be backported. Once I've got all these fixes deployed to our production site I'll check it again.

All 6 comments

It actually produces two warnings, I realized:

[16-Sep-2019 18:01:17 UTC] PHP Warning:  Illegal string offset '' in /Users/connorshea/code/sites/SuiteCRM/modules/AOW_WorkFlow/aow_utils.php on line 532
[16-Sep-2019 18:01:17 UTC] PHP Warning:  Cannot assign an empty string to a string offset in /Users/connorshea/code/sites/SuiteCRM/modules/AOW_WorkFlow/aow_utils.php on line 532

Unfortunately I think this might be rather difficult to fix without a breaking change that'd rename the '' key in all these fields :/

Oh, actually I think I misunderstood this. It's an error because we're trying to use '' as an offset for a _string_, not an array. This can be fixed by just checking that it's an array.

Off-topic: @connorshea since you like to clear up messages in logs (something I also appreciate) you might enjoy reading this old thread in the Forums:

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/13477-grep-ing-logs-for-most-common-messages

We could have a generic top-ten of most annoying and useless and frequent log messages, and squash them entirely, thereby eliminating millions of log lines form the world, which would likely have a measurable positive ecological impact.

@pgorod I think @Dillon-Brown's Sentry PR (#7873) will be extremely helpful in determining what the most common errors would be :) For now I'm just doing what effects our instance specifically.

Oh, nevermind I looked at that thread you linked, I hadn't realized there were commands in that thread for determining the most common notices :D

The top few notices are the ones I've fixed in the last few days, that plus the mPDF fix (#7111) which should probably be backported. Once I've got all these fixes deployed to our production site I'll check it again.

Was this page helpful?
0 / 5 - 0 ratings