File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 5050use GraphQL \Validator \Rules \VariablesAreInputTypes ;
5151use GraphQL \Validator \Rules \VariablesInAllowedPosition ;
5252use Psr \SimpleCache \CacheInterface ;
53+ use Psr \SimpleCache \InvalidArgumentException ;
5354
5455/**
5556 * Implements the "Validation" section of the spec.
@@ -108,9 +109,11 @@ public static function validate(
108109 if (isset ($ cache )) {
109110 $ cacheKey = 'gql_validation_ ' . md5 ($ ast ->__toString ());
110111
111- if ($ cache ->has ($ cacheKey )) {
112- return $ cache ->get ($ cacheKey );
113- }
112+ try {
113+ if ($ cache ->has ($ cacheKey )) {
114+ return $ cache ->get ($ cacheKey );
115+ }
116+ } catch (InvalidArgumentException $ e ) {}
114117 }
115118
116119 $ rules ??= static ::allRules ();
@@ -137,9 +140,11 @@ public static function validate(
137140 $ errors = $ context ->getErrors ();
138141
139142 // Only cache clean results
140- if ($ cache && $ cacheKey && count ($ errors ) === 0 ) {
141- $ cache ->set ($ cacheKey , $ errors );
142- }
143+ try {
144+ if (isset ($ cacheKey ) && count ($ errors ) === 0 ) {
145+ $ cache ->set ($ cacheKey , $ errors );
146+ }
147+ } catch (InvalidArgumentException $ e ) {}
143148
144149 return $ errors ;
145150 }
You can’t perform that action at this time.
0 commit comments