com phpruntests: Fix bug in gzip/deflate post init(): src/testcase/sections/configurationsections/rtDeflatePostSection.php
src/testcase/sections/configurationsections/rtGzipPostSection.php
| From: | Zoe Slattery | Date: | Sun, 20 May 2012 22:05:02 +0000 |
| Subject: | com phpruntests: Fix bug in gzip/deflate post init(): src/testcase/sections/configurationsections/rtDeflatePostSection.php src/testcase/sections/configurationsections/rtGzipPostSection.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66589@lists.php.net to get a copy of this message | ||
Commit: ddc50ad101f32115833a7c01ced8001bc12807c2
Author: zoe slattery <zoe@php.net> Sun, 20 May 2012 23:05:02 +0100
Parents: 56369c55651f06d411397928900c8c9ce1e64652
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=ddc50ad101f32115833a7c01ced8001bc12807c2
Log:
Fix bug in gzip/deflate post init()
Changed paths:
M src/testcase/sections/configurationsections/rtDeflatePostSection.php
M src/testcase/sections/configurationsections/rtGzipPostSection.php
Diff:
diff --git a/src/testcase/sections/configurationsections/rtDeflatePostSection.php
b/src/testcase/sections/configurationsections/rtDeflatePostSection.php
index c314f76..eb3eacf 100644
--- a/src/testcase/sections/configurationsections/rtDeflatePostSection.php
+++ b/src/testcase/sections/configurationsections/rtDeflatePostSection.php
@@ -20,15 +20,17 @@ class rtDeflatePostSection extends rtConfigurationSection
protected function init()
{
$postString = implode("\n", $this->sectionContents);
- $compressedPostString = gzcompress($postString);
+ if(extension_loaded('zlib')) {
+ $compressedPostString = gzcompress($postString);
- $this->postVariables['CONTENT_TYPE'] =
'application/x-www-form-urlencoded';
- $this->postVariables['CONTENT_LENGTH'] = strlen($compressedPostString);
- $this->postVariables['REQUEST_METHOD'] = 'POST';
+ $this->postVariables['CONTENT_TYPE'] =
'application/x-www-form-urlencoded';
+ $this->postVariables['CONTENT_LENGTH'] = strlen($compressedPostString);
+ $this->postVariables['REQUEST_METHOD'] = 'POST';
- $this->postFileName = $this->testName . ".post";
+ $this->postFileName = $this->testName . ".post";
- file_put_contents($this->postFileName, $compressedPostString);
+ file_put_contents($this->postFileName, $compressedPostString);
+ }
}
/**
diff --git a/src/testcase/sections/configurationsections/rtGzipPostSection.php
b/src/testcase/sections/configurationsections/rtGzipPostSection.php
index 778691a..cbcd692 100644
--- a/src/testcase/sections/configurationsections/rtGzipPostSection.php
+++ b/src/testcase/sections/configurationsections/rtGzipPostSection.php
@@ -20,15 +20,18 @@ class rtGzipPostSection extends rtConfigurationSection
protected function init()
{
$postString = implode("\n", $this->sectionContents);
- $gzipPostString = gzencode($postString);
+ if (extension_loaded('zlib')) {
+ $gzipPostString = gzencode($postString);
- $this->postVariables['CONTENT_TYPE'] =
'application/x-www-form-urlencoded';
- $this->postVariables['CONTENT_LENGTH'] = strlen($gzipPostString);
- $this->postVariables['REQUEST_METHOD'] = 'POST';
+
+ $this->postVariables['CONTENT_TYPE'] =
'application/x-www-form-urlencoded';
+ $this->postVariables['CONTENT_LENGTH'] = strlen($gzipPostString);
+ $this->postVariables['REQUEST_METHOD'] = 'POST';
- $this->postFileName = $this->testName . ".post";
+ $this->postFileName = $this->testName . ".post";
- file_put_contents($this->postFileName, $gzipPostString);
+ file_put_contents($this->postFileName, $gzipPostString);
+ }
}
/**