File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
class Curl
6
6
{
7
- const VERSION = '4.7.1 ' ;
7
+ const VERSION = '4.8.0 ' ;
8
8
const DEFAULT_TIMEOUT = 30 ;
9
9
10
10
public $ curl ;
@@ -795,9 +795,15 @@ public function unsetHeader($key)
795
795
* @access public
796
796
* @param $on
797
797
*/
798
- public function verbose ($ on = true )
798
+ public function verbose ($ on = true , $ output = STDERR )
799
799
{
800
+ // Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
801
+ // effect of causing Curl::requestHeaders to be empty.
802
+ if ($ on ) {
803
+ $ this ->setOpt (CURLINFO_HEADER_OUT , false );
804
+ }
800
805
$ this ->setOpt (CURLOPT_VERBOSE , $ on );
806
+ $ this ->setOpt (CURLOPT_STDERR , $ output );
801
807
}
802
808
803
809
/**
Original file line number Diff line number Diff line change @@ -2526,4 +2526,24 @@ public function testMemoryLeak()
2526
2526
}
2527
2527
}
2528
2528
}
2529
+
2530
+ public function testAlternativeStandardErrorOutput ()
2531
+ {
2532
+ // Skip test on HHVM due to "Segmentation fault".
2533
+ if (defined ('HHVM_VERSION ' )) {
2534
+ return ;
2535
+ }
2536
+
2537
+ $ buffer = fopen ('php://memory ' , 'w+ ' );
2538
+
2539
+ $ curl = new Curl ();
2540
+ $ curl ->verbose (true , $ buffer );
2541
+ $ curl ->post (Test::TEST_URL );
2542
+
2543
+ rewind ($ buffer );
2544
+ $ stderr = stream_get_contents ($ buffer );
2545
+ fclose ($ buffer );
2546
+
2547
+ $ this ->assertNotEmpty ($ stderr );
2548
+ }
2529
2549
}
You can’t perform that action at this time.
0 commit comments