Skip to content

Commit

Permalink
Avoid occurring chained warnings by parse_str()
Browse files Browse the repository at this point in the history
  • Loading branch information
tanakahisateru committed Apr 12, 2022
1 parent bb0e839 commit 86b4483
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/DataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ protected function getRequest()
$postData = array();
$body = $request->getBody();
if ($body !== null) {
parse_str($body, $postData);
// PHP reports warning if parse_str() detects more than max_input_vars items.
@parse_str($body, $postData);
}
$request->setPost($postData);
}
Expand Down
6 changes: 4 additions & 2 deletions src/Scrubber.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public function internalScrub(&$data, $fields, $replacement, $path)
$data
);
} else {
parse_str($data, $parsedData);
// PHP reports warning if parse_str() detects more than max_input_vars items.
@parse_str($data, $parsedData);
if (http_build_query($parsedData) === $data) {
$data = $this->scrubQueryString($data, $fields);
}
Expand Down Expand Up @@ -131,7 +132,8 @@ protected function scrubArray(&$arr, $fields, $replacement = '********', $path =

protected function scrubQueryString($query, $fields, $replacement = 'xxxxxxxx')
{
parse_str($query, $parsed);
// PHP reports warning if parse_str() detects more than max_input_vars items.
@parse_str($query, $parsed);
$scrubbed = $this->internalScrub($parsed, $fields, $replacement, '');
return http_build_query($scrubbed);
}
Expand Down

0 comments on commit 86b4483

Please sign in to comment.