Skip to content

Commit

Permalink
Merge pull request #12716 from hypeJunction/post-body
Browse files Browse the repository at this point in the history
fix(http): request validation now correctly reads payload
  • Loading branch information
jdalsem committed Jul 11, 2019
2 parents bcddc0c + c5e18f4 commit baea1db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engine/classes/Elgg/Http/Request.php
Expand Up @@ -414,10 +414,14 @@ public function getFile($input_name, $check_for_validity = true) {
public function validate() {

$reported_bytes = $this->server->get('CONTENT_LENGTH');

// Requests with multipart content type
$post_data_count = count($this->request->all());

// Requests with other content types
$post_body_length = is_string($this->content) ? strlen($this->content) : 0;
$content = $this->getContent();
$post_body_length = is_string($content) ? strlen($content) : 0;

$file_count = count($this->files->all());

$is_valid = function() use ($reported_bytes, $post_data_count, $post_body_length, $file_count) {
Expand Down

0 comments on commit baea1db

Please sign in to comment.