@@ -204,52 +204,62 @@ public function executeFirewall($rules)
204204 continue ;
205205 }
206206
207- // Extract the value of the paramater that we want.
208- $ values = $ this ->request ->getParameterValues ($ rule ['parameter ' ]);
209- if (is_null ($ values ) && $ rule ['parameter ' ] !== false && $ rule ['parameter ' ] != 'rules ' ) {
210- continue ;
211- }
212-
213- // For special parameter values we just set the array to a single null value.
214- if ($ rule ['parameter ' ] === false || $ rule ['parameter ' ] == 'rules ' ) {
215- $ values = [null ];
207+ // Cast to an array so we can iterate through all parameters.
208+ if (!is_array ($ rule ['parameter ' ])) {
209+ $ parameters = [$ rule ['parameter ' ]];
210+ } else {
211+ $ parameters = $ rule ['parameter ' ];
216212 }
217213
218- // For all field matches, we want to execute the rule against it.
219- foreach ($ values as $ value ) {
220- // Apply mutations, if any.
221- if (isset ($ rule ['mutations ' ]) && is_array ($ rule ['mutations ' ])) {
222- $ value = $ this ->request ->applyMutation ($ rule ['mutations ' ], $ value );
223- if (is_null ($ value )) {
224- continue ;
225- }
214+ // Iterate through all parameters.
215+ foreach ($ parameters as $ parameter ) {
216+ // Extract the value of the paramater that we want.
217+ $ values = $ this ->request ->getParameterValues ($ parameter );
218+ if (is_null ($ values ) && $ parameter !== false && $ parameter != 'rules ' ) {
219+ continue ;
226220 }
227221
228- // Perform the matching.
229- if (isset ($ rule ['match ' ]) && is_array ($ rule ['match ' ]) || isset ($ rule ['rules ' ])) {
222+ // For special parameter values we just set the array to a single null value.
223+ if ($ parameter === false || $ parameter == 'rules ' ) {
224+ $ values = [null ];
225+ }
230226
231- // Do we have to process child-rules?
232- if (isset ($ rule ['rules ' ])) {
233- $ match = $ this ->executeFirewall ($ rule ['rules ' ]);
234- } else {
235- $ match = $ this ->matchParameterValue ($ rule ['match ' ], $ value );
227+ // For all field matches, we want to execute the rule against it.
228+ foreach ($ values as $ value ) {
229+ // Apply mutations, if any.
230+ if (isset ($ rule ['mutations ' ]) && is_array ($ rule ['mutations ' ])) {
231+ $ value = $ this ->request ->applyMutation ($ rule ['mutations ' ], $ value );
232+ if (is_null ($ value )) {
233+ continue ;
234+ }
236235 }
237236
238- // Is the rule a match?
239- if ($ match ) {
240- // In case there are multiple rules, they may require chained AND conditions.
241- if ($ inclusiveCount <= 1 || !isset ($ rule ['inclusive ' ]) || $ rule ['inclusive ' ] !== true ) {
242- return true ;
237+ // Perform the matching.
238+ if (isset ($ rule ['match ' ]) && is_array ($ rule ['match ' ]) || isset ($ rule ['rules ' ])) {
239+
240+ // Do we have to process child-rules?
241+ if (isset ($ rule ['rules ' ])) {
242+ $ match = $ this ->executeFirewall ($ rule ['rules ' ]);
243243 } else {
244- $ inclusiveHits ++;
244+ $ match = $ this ->matchParameterValue ($ rule ['match ' ], $ value );
245+ }
246+
247+ // Is the rule a match?
248+ if ($ match ) {
249+ // In case there are multiple rules, they may require chained AND conditions.
250+ if ($ inclusiveCount <= 1 || !isset ($ rule ['inclusive ' ]) || $ rule ['inclusive ' ] !== true ) {
251+ return true ;
252+ } else {
253+ $ inclusiveHits ++;
254+ }
245255 }
246256 }
247257 }
248258 }
249259 }
250260
251261 // In case we hit all of the AND conditions.
252- if ($ inclusiveCount > 1 && $ inclusiveHits == = $ inclusiveCount ) {
262+ if ($ inclusiveCount > 1 && $ inclusiveHits > = $ inclusiveCount ) {
253263 return true ;
254264 }
255265
0 commit comments