Skip to content

HTML form gen fix crash when required prop is not defined#300

Merged
MaddyUnderStars merged 1 commit intodevelopfrom
fix/html_form_undef_prop
May 9, 2024
Merged

HTML form gen fix crash when required prop is not defined#300
MaddyUnderStars merged 1 commit intodevelopfrom
fix/html_form_undef_prop

Conversation

@MaddyUnderStars
Copy link
Contributor

@MaddyUnderStars MaddyUnderStars commented May 9, 2024

Checklist

  • I'm using the correct PHP Version (8.1 for current, 7.4 for legacy).
  • I've added comments to any new methods I've created or where else relevant.
  • I've replaced magic method usage on DbService classes with the getInstance() static method.
  • I've written any documentation for new features or where else relevant in the docs repo.

Description

Dalton found a crash in the AEC modules where a html form was being generated but $field->required wasn't defined and the generator doesn't check it exists before accessing it.

This has been tested by Dalton and I on my local system and the dev aec instance

Changelog

  • Added a check for if the property exists before accessing it.

refs:
issues:

Other Information

Docs pull request:

@DaltJM
Copy link

DaltJM commented May 9, 2024

Additional Context: When approving a saved article, the following error would be logged:

[2024-05-09 09:09:07.878678] FACILITATOR.ERROR: Number: 2, String: Undefined property: Html\Form\Banner::$required, File: /var/www/html/composer/vendor/2pisoftware/cmfive-core/system/classes/HtmlBootstrap5.php, Line: 146 {
    "user": 5949
} {
    "url": "/facilitator-articles/edit/171&event_id=273",
    "ip": "10.11.2.100",
    "http_method": "GET",
    "server": "_",
    "referrer": "https://dev.aec.cosinecrm.com.au/bridge-news"
}

Maddy has made the changes described above and I can confirm that the error above no longer appears in the logs and the article successfully publishes to the dev website. The security tab and MFA fixes are still present.

@chris-bateman
Copy link
Member

LGTM

@MaddyUnderStars MaddyUnderStars merged commit b2d982c into develop May 9, 2024
@MaddyUnderStars MaddyUnderStars deleted the fix/html_form_undef_prop branch May 9, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants