Skip to content

ErrorException: StringConstraint.php:42 -- preg_match(): Unknown modifier 'r' #526

Closed
@claudiofreitas

Description

@claudiofreitas

Hello,

I have a schema.json like below, and when I try to validate my json (also below) I'm receiving the Exception from the title.

schema.json:

{
    "$schema": "http://json-schema.org/schema#",
    "type": "string",
    "pattern": "^\\#ref\\(.+\\)$"
}

json:

"ref"

Investigating the StringConstraint.php, on line 42 it has this code:

if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {

which is replacing # by \\# and concatenating everything with #-prefix and #u-suffix.

Am I going something wrong or is it a bug?

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