Annotation of embedaddon/php/ext/curl/tests/bug48203.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
                      3: --SKIPIF--
                      4: <?php 
                      5: if (!extension_loaded("curl")) {
                      6:        exit("skip curl extension not loaded");
                      7: }
                      8: if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER'))  {
                      9:        exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
                     10: }
                     11: ?>
                     12: --FILE--
                     13: <?php
                     14: 
                     15: $fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
                     16: 
                     17: $ch = curl_init();
                     18: 
                     19: curl_setopt($ch, CURLOPT_VERBOSE, 1);
                     20: curl_setopt($ch, CURLOPT_STDERR, $fp);
                     21: curl_setopt($ch, CURLOPT_URL, getenv('PHP_CURL_HTTP_REMOTE_SERVER'));
                     22: 
                     23: fclose($fp); // <-- premature close of $fp caused a crash!
                     24: 
                     25: curl_exec($ch);
                     26: curl_close($ch);
                     27: 
                     28: echo "Ok\n";
                     29: 
                     30: ?>
                     31: --CLEAN--
                     32: <?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
                     33: --EXPECTF--
                     34: Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %sbug48203.php on line %d
                     35: %A
                     36: Ok

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>