Skip to content

Input object validation problem #467

Closed

Description

@alekseideviatov

Steps to reproduce:

  1. Create schema and some field with Input object argument
input MsgInput {
  msg: String
}

type Query {
  echo(msg: MsgInput): String
}

schema {
    query: Query
}
  1. Make query and pass input argument through variable as array
{"query":"query echo ($msg: MsgInput) {\n  echo (msg: $msg)\n}","variables":{"msg":["my message"]},"operationName":null}

Expected correct response with error:
Variable \"$msg\" got invalid value [\"my message\"]; Field \"0\" is not defined by type MsgInput.

Actual result:

Fatal error: Uncaught TypeError: mb_strlen() expects parameter 1 to be string, int given in /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Utils/Utils.php:627 Stack trace: #0 /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Utils/Utils.php(627): mb_strlen(0) #1 /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Utils/Value.php(203): GraphQL\Utils\Utils::suggestionList(0, Array) #2 /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Executor/Values.php(61): GraphQL\Utils\Value::coerceValue(Array, Object(GraphQL\Type\Definition\InputObjectType), Object(GraphQL\Language\AST\VariableDefinitionNode)) #3 /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(172): GraphQL\Executor\Values::getVariableValues(Object(GraphQL\Type\Schema), Object(GraphQL\Language\AST\NodeList), Array) #4 /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(83): GraphQL\Executor\ReferenceExecutor::buildExecutionContext(Object in /var/www/github/issues/webonyx/vendor/webonyx/graphql-php/src/Utils/Utils.php on line 627

Activity

  1. vladar commented on Jun 19, 2019

    @vladar
    Member

    Should be fixed in master. Thanks for the detailed description.

  2. added a commit that references this issue on Aug 7, 2019
    27340a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions