Skip to content

Commit 04d8aab

Browse files
committed
Merge branch 'master' into 170
2 parents ebf406c + 20646ba commit 04d8aab

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# PHP Curl Class Documentation
22
http://www.phpcurlclass.com/
3+
4+
The [examples](https://github.com/php-curl-class/php-curl-class/tree/master/examples) are a great starting point.

src/Curl/Curl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class Curl
5858

5959
public $baseUrl = null;
6060
public $url = null;
61+
public $effectiveUrl = null;
6162
public $requestHeaders = null;
6263
public $responseHeaders = null;
6364
public $rawResponseHeaders = '';
@@ -346,6 +347,7 @@ public function exec($ch = null)
346347
$this->httpError = in_array(floor($this->httpStatusCode / 100), array(4, 5));
347348
$this->error = $this->curlError || $this->httpError;
348349
$this->errorCode = $this->error ? ($this->curlError ? $this->curlErrorCode : $this->httpStatusCode) : 0;
350+
$this->effectiveUrl = curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL);
349351

350352
// NOTE: CURLINFO_HEADER_OUT set to true is required for requestHeaders
351353
// to not be empty (e.g. $curl->setOpt(CURLINFO_HEADER_OUT, true);).

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,18 @@ public function testSetUrl()
250250
$this->assertEquals('key=value', $curl->response);
251251
}
252252

253+
public function testEffectiveUrl()
254+
{
255+
$test = new Test();
256+
$test->server('redirect', 'GET');
257+
$this->assertEquals(Test::TEST_URL, $test->curl->effectiveUrl);
258+
259+
$test = new Test();
260+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
261+
$test->server('redirect', 'GET');
262+
$this->assertEquals(Test::TEST_URL . '?redirect', $test->curl->effectiveUrl);
263+
}
264+
253265
public function testPostRequestMethod()
254266
{
255267
$test = new Test();
@@ -2517,6 +2529,12 @@ public function testRequestMethodSuccessiveOptionsRequests()
25172529

25182530
public function testMemoryLeak()
25192531
{
2532+
// Skip memory leak test failing for PHP 7.
2533+
// "Failed asserting that 8192 is less than 1000."
2534+
if (getenv('TRAVIS_PHP_VERSION') === '7.0') {
2535+
return;
2536+
}
2537+
25202538
ob_start();
25212539
echo '[';
25222540
for ($i = 0; $i < 10; $i++) {

0 commit comments

Comments
 (0)