Skip to content

Error with regex in Str::placeholders #37

Open
@Spidlace

Description

@Spidlace

Hello,

I'm reporting an error I detected when I wanted to use in Bolt/Forms extension, parameters replyto_email and replyto_name.

The form returns me an error:

"An exception has been thrown during the rendering of a template ("Email "email" does not comply with addr-spec of RFC 2822.")."

After debugging, it turns out that the error comes from bolt/common, in the placeholders method.

The regexp doesn't seem to be good at detecting the string sent to it.

Example to reproduce the bug:

  1. Install last bolt version
  2. Install last bolt/forms version
  3. Create form with notification parameters like that :
notification:
        enabled: true
        debug: false
        debug_address: [email protected] # Email address used when debug mode is enabled
        debug_smtp: true
        subject: New contact
        subject_prefix: '[XXX]'
        to_name: 'John'
        to_email: '[email protected]'
        from_name: 'James'
        from_email: '[email protected]'
        replyto_name: lastname
        replyto_email: email
  1. Add two fields
lastname:
            type: text
            fieldLabel: Nom
            options:
                required: true
                label: Lastname
                constraints: [ NotBlank ]
                attr:
                    placeholder: Nom
email:
            type: email
            fieldLabel: Email
            options:
                required: true
                constraints: [ NotBlank, Email ]
                attr:
                    placeholder: Email
  1. Test form
  2. Error appear

Here a pr to fix it (works for me)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions