This repository was archived by the owner on Sep 22, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -795,14 +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
800
// Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
801
801
// effect of causing Curl::requestHeaders to be empty.
802
802
if ($ on ) {
803
803
$ this ->setOpt (CURLINFO_HEADER_OUT , false );
804
804
}
805
805
$ this ->setOpt (CURLOPT_VERBOSE , $ on );
806
+ $ this ->setOpt (CURLOPT_STDERR , $ output );
806
807
}
807
808
808
809
/**
Original file line number Diff line number Diff line change @@ -2526,4 +2526,19 @@ public function testMemoryLeak()
2526
2526
}
2527
2527
}
2528
2528
}
2529
+
2530
+ public function testAlternativeStandardErrorOutput ()
2531
+ {
2532
+ $ buffer = fopen ('php://memory ' , 'w+ ' );
2533
+
2534
+ $ curl = new Curl ();
2535
+ $ curl ->verbose (true , $ buffer );
2536
+ $ curl ->post (Test::TEST_URL );
2537
+
2538
+ rewind ($ buffer );
2539
+ $ stderr = stream_get_contents ($ buffer );
2540
+ fclose ($ buffer );
2541
+
2542
+ $ this ->assertNotEmpty ($ stderr );
2543
+ }
2529
2544
}
You can’t perform that action at this time.
0 commit comments