https://bugzilla.wikimedia.org/show_bug.cgi?id=65607

            Bug ID: 65607
           Summary: Empty objects can pass schemas with required fields
           Product: Analytics
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: Unprioritized
         Component: EventLogging
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]
       Web browser: ---
   Mobile Platform: ---

I found this while testing the fix for bug 65385, but it's a distinct (and more
serious) issue.

Blank objects can pass schemas with required fields.  To test, run the
following in phpsh:

---
$schema = array(
    'properties' => array(
        'someRequiredField' => array(
            'type' => 'string',
            'required' => true
        )
    )
);

var_export( efSchemaValidate( array(), $schema ) );

var_export( efSchemaValidate( array( 'a' => 'b' ), $schema ) );

---
The first passes, which is the bug.  The second throws:

Missing required field "someRequiredField"

as expected (It is also invalid for an additional reason, the extra property,
but there is no issue, since it fails it for one of the correct reasons).

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to