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 50
50
use GraphQL \Validator \Rules \VariablesAreInputTypes ;
51
51
use GraphQL \Validator \Rules \VariablesInAllowedPosition ;
52
52
use Psr \SimpleCache \CacheInterface ;
53
+ use Psr \SimpleCache \InvalidArgumentException ;
53
54
54
55
/**
55
56
* Implements the "Validation" section of the spec.
@@ -108,9 +109,11 @@ public static function validate(
108
109
if (isset ($ cache )) {
109
110
$ cacheKey = 'gql_validation_ ' . md5 ($ ast ->__toString ());
110
111
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 ) {}
114
117
}
115
118
116
119
$ rules ??= static ::allRules ();
@@ -137,9 +140,11 @@ public static function validate(
137
140
$ errors = $ context ->getErrors ();
138
141
139
142
// 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 ) {}
143
148
144
149
return $ errors ;
145
150
}
You can’t perform that action at this time.
0 commit comments