Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed gz decompress check for false #5754

Closed
wants to merge 1 commit into from

3 participants

@adam-ja

Previously if the decompressed value was, say, 0 an exception would be
thrown even though the decompression was successful. By making the check
for false strict the exception will still be thrown if there is an error
in the underlying PHP functions, while allowing us to return
decompressed values that would otherwise evaluate to false.

@adam-ja adam-ja Fixed gz decompress check for false
Previously if the decompressed value was, say, 0 an exception would be
thrown even though the decompression was successful. By making the check
for false strict the exception will still be thrown if there is an error
    in the underlying PHP functions, while allowing us to return
    decompressed values that would otherwise evaluate to false.
29b48bd
@Maks3w
Collaborator

Please add a unit test

@weierophinney weierophinney added this to the 2.2.6 milestone
@weierophinney

@Maks3w I'm actually not sure how to unit test this. Code is explicit and makes sense here. Marking for 2.2.6.

@adam-ja

Oops, was meaning to look back at this when I got chance. I looked at unit testing this when I first wrote it but current coverage isn't that fine grained and as @weierophinney says there's no obvious way of testing the change. Thanks :-)

@Maks3w
Collaborator

This kind of changes due the way of PHP interpret false values are for me very relevant for to be tested

@weierophinney weierophinney self-assigned this
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/5754' into develop
Forward port #5754
f93a765
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2014
  1. @adam-ja

    Fixed gz decompress check for false

    adam-ja authored
    Previously if the decompressed value was, say, 0 an exception would be
    thrown even though the decompression was successful. By making the check
    for false strict the exception will still be thrown if there is an error
        in the underlying PHP functions, while allowing us to return
        decompressed values that would otherwise evaluate to false.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  library/Zend/Filter/Compress/Gz.php
View
2  library/Zend/Filter/Compress/Gz.php
@@ -190,7 +190,7 @@ public function decompress($content)
$compressed = gzuncompress($content);
}
- if (!$compressed) {
+ if ($compressed === false) {
throw new Exception\RuntimeException('Error during decompression');
}
Something went wrong with that request. Please try again.