the-events-calendar / ql-events

The Events Calendar binding to WPGraphQL
16 stars 7 forks source link

No object in get_ticket_args() #26

Open justlevine opened 3 years ago

justlevine commented 3 years ago

Getting an issue in Ticket_Connection_Resolver::get_ticket_args().

When the query is run in Graphiql, is_object( $source) is evaluating to false for some reason, which causes the $connection_type to be undefined, and throws the following PHP notice: Undefined variable: connection_type in /var/www/thegsc/wp-content/plugins/ql-events/includes/data/connection/class-ticket-connection-resolver.php on line 53.

Can be solved one of three ways:

  1. Set $connection_type = false at the top of the function.
  2. Return early if source isnt an object:
if ( ! is_object( $source ) {
    return $query_args;
}

switch( $info->fieldName) { 
...
  1. change if ($connection_type) to if ( isset ( $connection_type ) ).

Not sure it matters, but because I don't know why `is_object( $source ) is false, I dont want to be responsible for hiding a deeper issue.

Thoughts?