What is this WARNING: E_WARNING: Undefined array key "maxLength"

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • murugappan
    replied
    Hi All,

    This is an update on the current status of the problem. With version 8.3.5 issue problem no longer occurs.

    yuri Thank you.

    THIS TOPIC IS NOW CLOSED.

    Leave a comment:


  • murugappan
    commented on 's reply
    Hi shalmaxb sorry for the late reply. I do not have any formula or optional conditions set. Just plain simple enum.

  • shalmaxb
    replied
    do you have any formula, that is setting the enum to empty?

    Leave a comment:


  • murugappan
    replied
    shalmaxb hi,

    Thank you for responding. I did as you advised and i still get the warning. This is testnum i created which has no blank option and default is set correctly (see screencap below):


    Click image for larger version

Name:	enum_de2f.png
Views:	450
Size:	29.3 KB
ID:	106289

    Leave a comment:


  • shalmaxb
    replied
    You have one empty option in your enum and that is configured to be default. I guess the error would go, if you either delete the empty option or refer default to another option.

    Leave a comment:


  • murugappan
    replied
    Looks like there is solutions to this. Did anyone else get this problem?

    Leave a comment:


  • murugappan
    replied
    yuri

    This problem is not resolved in 8.2.4. Any advise, please?​

    Leave a comment:


  • murugappan
    replied
    item yuri

    Any advise or resolution on this, please?

    Leave a comment:


  • murugappan
    commented on 's reply
    @item

    (1) If you a upgrading from version 8.1.5, the existing enums do not have the "maxLength" and they do not produce this warnings. But if you create a new enum, the "maxLength" parameter appears and the warning will be logged.

    (2) The warnings appear only when we create or customize the enum field not when when the user uses them in the form. Yet i am still concerned because, as this is a PHP warning, i am not sure if later it may cause some other fatal issues. I would want to get rid of the problem before going into production mode.

    (3) My PHP Version is 8.1.12. Once i complete my re-engineering i will migrate them to PHP 8.2.x.

    (4) as you stated "...certainly before or after Yuri have make this params" I am not sure if there was any indication in any of the releases where this enhancement is mentioned or explained. I will check again, i could have missed it.
    Last edited by murugappan; 05-03-2024, 04:48 AM.

  • item
    commented on 's reply
    Hi murugappan,
    now you have give a "full helping info" .. but it's out of my knowledge now
    maybe have you a different php version ?

    when i say entityDefs, it's the entityDefs where you have this field.
    I have to see "maxLength" to my instance.. somewhere, and not somewhere.. certainly before or after Yuri have make this params.

    I have some enum field without this params, with this params and not warning. (i use last php version always)

  • murugappan
    replied
    item victor

    Thank you for responding.

    (1) I know about the custom prefix and i set that to 'true' in config.php because i do not want the prefix as i already have the c_ prefix.
    (2) entityDefs.json? Which one and where?
    (3) I do not have any validation rules for these fields.

    add : "maxLength": 100 to field enum in entityDefs
    . my question is the same as (2).

    Additional Notes:
    (1) In the case where i upgraded, the problem des not exist when i change existing enum fields, it only happens when i add a new enum field. I upgraded from 8.1.5. Version 8.1.5 does not have this problem.
    (2) I tried multiple fresh installation from 8.2.0 to 8.2.3 and all of them have the same problem.


    Latest Update (2024-05-01)

    I did some further debugging. I compared the Custom->metadata->entitDef-><entity> for version 8.1.5 and 8.2.3. I found that the enum definition for 8.2.3 has the "maxLength" parameter for enum fields (s ee screencap below). In 8.1.5 this parameter is not there. So i removed the parameter in 8.2.3 and the warning disappeared. I may found the cause but not the solution. I am sorry I do not have the technical knowledge of espocrm code.​

    Click image for larger version

Name:	maxlength parameter.png
Views:	567
Size:	9.8 KB
ID:	105631
    Last edited by murugappan; 05-01-2024, 10:44 AM.

    Leave a comment:


  • item
    replied
    Hi,

    espocrm v8.2 added custom prefix.. https://github.com/espocrm/espocrm/issues/2988

    what is your config.php ? a copy from one old instance ?
    what is your entityDefs.json ?
    have you validation rules for this field ?

    add : "maxLength": 100 to field enum in entityDefs..

    Leave a comment:


  • murugappan
    replied
    victor

    Unfortunately, this is not true in my case. All the enums have options defined (see below). I did the same in version 8.1.5 and there were no problems. In version 8.1.5 i could save an empty enum and it will still work.

    Click image for larger version  Name:	enum_def.png Views:	0 Size:	28.9 KB ID:	105595



    Last edited by murugappan; 04-30-2024, 03:51 AM.

    Leave a comment:


  • victor
    replied
    The “Undefined array key” warning tells you that your code refers to an array key without a value.
    And in your case, it means that when you created the field with Enum type, you didn't specify any Options for it.

    Click image for larger version  Name:	image.png Views:	0 Size:	20.6 KB ID:	105592
    Last edited by victor; 04-29-2024, 10:53 PM.

    Leave a comment:


  • murugappan
    replied
    victor

    The Debug log below:

    espo-2024-04-29.log.zip

    I did some debugging
    tests and what i found was that it only happens when we create a fresh instance of espocrm using version 8.2.2 or 8.2.3 (not sure about 8.2.0 and 8.2.1). It does not happen when i save enums in instances which were upgraded from versions < 8.2.0
    Attached Files
    Last edited by murugappan; 04-29-2024, 10:51 PM.

    Leave a comment:

Working...