Skip to content

Commit 5a649ab

Browse files
committed
Fixed: PHP warning.
Fixed: incorrect data extraction on empty RAW payload.
1 parent 9601eb8 commit 5a649ab

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/Processor.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ public function __get($name)
103103
public function launch($mustExit = true)
104104
{
105105
// Determine if the user is temporarily blocked from the site before we do anything else.
106-
if (
107-
$this->extension->isBlocked($this->autoblockMinutes, $this->autoblockTime, $this->autoblockAttempts) && !$this->extension->canBypass($this->mustUsePluginCall)
108-
) {
106+
$isWhitelisted = $this->extension->canBypass($this->mustUsePluginCall);
107+
if (!$isWhitelisted && $this->extension->isBlocked($this->autoblockMinutes, $this->autoblockTime, $this->autoblockAttempts)) {
109108
$this->extension->forceExit(22);
110109
}
111110

@@ -119,9 +118,6 @@ public function launch($mustExit = true)
119118
return true;
120119
}
121120

122-
// Determine if the current request is whitelisted or not.
123-
$isWhitelisted = $this->extension->canBypass($this->mustUsePluginCall);
124-
125121
// Merge the rules together. First iterate through the whitelist rules because
126122
// we want to whitelist the request if there's a whitelist rule match.
127123
$rules = array_merge($this->whitelistRules, $this->firewallRules);

src/Request.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function getParameterValues($parameter, $data = [])
118118

119119
// If it's not an array, no need to continue.
120120
if (!is_array($data)) {
121-
return [$data];
121+
$data = [$data];
122122
}
123123
default:
124124
break;
@@ -412,6 +412,12 @@ public function getShortcodeAtts($value)
412412

413413
// Merge together if the shortcode occurs more than once.
414414
if (isset($return[$shortcode[2]])) {
415+
416+
// Shortcode index must not be a string.
417+
if (is_string($return[$shortcode[2]])) {
418+
continue;
419+
}
420+
415421
$atts = @\shortcode_parse_atts($shortcode[3]);
416422
foreach ($atts as $key => $value) {
417423
if (isset($return[$shortcode[2]][$key])) {

0 commit comments

Comments
 (0)