PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/curl/tests/curl_basic_017.phpt ('Test curl_multi_exec() function with basic functionality')

Script

1: <?php
2:
/* Prototype  : bool curl_multi_exec(resource ch)
3:  * Description: Perform a cURL session
4:  * Source code: ext/curl/multi.c
5:  * Alias to functions:
6:  */
7:
8:   
include 'server.inc';
9:   
$host curl_cli_server_start();
10:
11:   
// start testing
12:   
echo "*** Testing curl_exec() : basic functionality ***\n";
13:
14:   
$url "{$host}/get.inc?test=get";
15:   
$chs = array(
16:     
=> curl_init(),
17:     
=> curl_init(),
18:     
=> curl_init(),
19:   );
20:
21:   
ob_start(); // start output buffering
22:
23:   
curl_setopt($chs[0], CURLOPT_URL$url); //set the url we want to use
24:   
curl_setopt($chs[1], CURLOPT_URL$url); //set the url we want to use
25:   
curl_setopt($chs[2], CURLOPT_URL$url); //set the url we want to use
26:
27:   
$mh curl_multi_init();
28:
29:   
// add handlers
30:   
curl_multi_add_handle($mh$chs[0]);
31:   
curl_multi_add_handle($mh$chs[1]);
32:   
curl_multi_add_handle($mh$chs[2]);
33:
34:   
$running=null;
35:   
//execute the handles
36:   
$state null;
37:   do {
38:     
$state curl_multi_exec($mh$running);
39:   } while (
$running 0);
40:
41:   
//close the handles
42:   
curl_multi_remove_handle($mh$chs[0]);
43:   
curl_multi_remove_handle($mh$chs[1]);
44:   
curl_multi_remove_handle($mh$chs[2]);
45:   
curl_multi_close($mh);
46:
47:   
$curl_content ob_get_contents();
48:   
ob_end_clean();
49:
50:   if(
$state === CURLM_OK) {
51:     
var_dump$curl_content );
52:   } else {
53:     echo 
"curl_exec returned false";
54:   }
55:
?>
56:
===DONE===
57:

Expected

*** Testing curl_exec() : basic functionality ***
string(75) "Hello World!
Hello World!Hello World!
Hello World!Hello World!
Hello World!"
===DONE===

Output

*** Testing curl_exec() : basic functionality ***
string(2919) "<?php
  $test = isset($_GET['test']) ? $_GET['test'] : null;
  switch($test) {
    case 'post':
      var_dump($_POST);
      break;
    case 'getpost':
      var_dump($_GET);
      var_dump($_POST);
      break;
    case 'referer':
      echo $_SERVER['HTTP_REFERER'];
      break;
    case 'useragent':
      echo $_SERVER['HTTP_USER_AGENT'];
      break;
    case 'httpversion':
      echo $_SERVER['SERVER_PROTOCOL'];
      break;
    case 'cookie':
      echo $_COOKIE['foo'];
      break;
    case 'encoding':
      echo $_SERVER['HTTP_ACCEPT_ENCODING'];
      break;
    case 'contenttype':
      header('Content-Type: text/plain;charset=utf-8');
      break;
    case 'file':
      if (isset($_FILES['file'])) {
          echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
      }
      break;
    case 'method':
      echo $_SERVER['REQUEST_METHOD'];
      break;
    default:
      echo "Hello World!\n";
      echo "Hello World!";
      break;
  }
?>
<?php
  $test = isset($_GET['test']) ? $_GET['test'] : null;
  switch($test) {
    case 'post':
      var_dump($_POST);
      break;
    case 'getpost':
      var_dump($_GET);
      var_dump($_POST);
      break;
    case 'referer':
      echo $_SERVER['HTTP_REFERER'];
      break;
    case 'useragent':
      echo $_SERVER['HTTP_USER_AGENT'];
      break;
    case 'httpversion':
      echo $_SERVER['SERVER_PROTOCOL'];
      break;
    case 'cookie':
      echo $_COOKIE['foo'];
      break;
    case 'encoding':
      echo $_SERVER['HTTP_ACCEPT_ENCODING'];
      break;
    case 'contenttype':
      header('Content-Type: text/plain;charset=utf-8');
      break;
    case 'file':
      if (isset($_FILES['file'])) {
          echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
      }
      break;
    case 'method':
      echo $_SERVER['REQUEST_METHOD'];
      break;
    default:
      echo "Hello World!\n";
      echo "Hello World!";
      break;
  }
?>
<?php
  $test = isset($_GET['test']) ? $_GET['test'] : null;
  switch($test) {
    case 'post':
      var_dump($_POST);
      break;
    case 'getpost':
      var_dump($_GET);
      var_dump($_POST);
      break;
    case 'referer':
      echo $_SERVER['HTTP_REFERER'];
      break;
    case 'useragent':
      echo $_SERVER['HTTP_USER_AGENT'];
      break;
    case 'httpversion':
      echo $_SERVER['SERVER_PROTOCOL'];
      break;
    case 'cookie':
      echo $_COOKIE['foo'];
      break;
    case 'encoding':
      echo $_SERVER['HTTP_ACCEPT_ENCODING'];
      break;
    case 'contenttype':
      header('Content-Type: text/plain;charset=utf-8');
      break;
    case 'file':
      if (isset($_FILES['file'])) {
          echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
      }
      break;
    case 'method':
      echo $_SERVER['REQUEST_METHOD'];
      break;
    default:
      echo "Hello World!\n";
      echo "Hello World!";
      break;
  }
?>
"
===DONE===

Diff

002+ string(2919) "<?php
003+   $test = isset($_GET['test']) ? $_GET['test'] : null;
004+   switch($test) {
005+     case 'post':
006+       var_dump($_POST);
002- string(75) "Hello World!
003- Hello World!Hello World!
004- Hello World!Hello World!
005- Hello World!"
006- ===DONE===
007+       break;
008+     case 'getpost':
009+       var_dump($_GET);
010+       var_dump($_POST);
011+       break;
012+     case 'referer':
013+       echo $_SERVER['HTTP_REFERER'];
014+       break;
015+     case 'useragent':
016+       echo $_SERVER['HTTP_USER_AGENT'];
017+       break;
018+     case 'httpversion':
019+       echo $_SERVER['SERVER_PROTOCOL'];
020+       break;
021+     case 'cookie':
022+       echo $_COOKIE['foo'];
023+       break;
024+     case 'encoding':
025+       echo $_SERVER['HTTP_ACCEPT_ENCODING'];
026+       break;
027+     case 'contenttype':
028+       header('Content-Type: text/plain;charset=utf-8');
029+       break;
030+     case 'file':
031+       if (isset($_FILES['file'])) {
032+           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
033+       }
034+       break;
035+     case 'method':
036+       echo $_SERVER['REQUEST_METHOD'];
037+       break;
038+     default:
039+       echo "Hello World!\n";
040+       echo "Hello World!";
041+       break;
042+   }
043+ ?>
044+ <?php
045+   $test = isset($_GET['test']) ? $_GET['test'] : null;
046+   switch($test) {
047+     case 'post':
048+       var_dump($_POST);
049+       break;
050+     case 'getpost':
051+       var_dump($_GET);
052+       var_dump($_POST);
053+       break;
054+     case 'referer':
055+       echo $_SERVER['HTTP_REFERER'];
056+       break;
057+     case 'useragent':
058+       echo $_SERVER['HTTP_USER_AGENT'];
059+       break;
060+     case 'httpversion':
061+       echo $_SERVER['SERVER_PROTOCOL'];
062+       break;
063+     case 'cookie':
064+       echo $_COOKIE['foo'];
065+       break;
066+     case 'encoding':
067+       echo $_SERVER['HTTP_ACCEPT_ENCODING'];
068+       break;
069+     case 'contenttype':
070+       header('Content-Type: text/plain;charset=utf-8');
071+       break;
072+     case 'file':
073+       if (isset($_FILES['file'])) {
074+           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
075+       }
076+       break;
077+     case 'method':
078+       echo $_SERVER['REQUEST_METHOD'];
079+       break;
080+     default:
081+       echo "Hello World!\n";
082+       echo "Hello World!";
083+       break;
084+   }
085+ ?>
086+ <?php
087+   $test = isset($_GET['test']) ? $_GET['test'] : null;
088+   switch($test) {
089+     case 'post':
090+       var_dump($_POST);
091+       break;
092+     case 'getpost':
093+       var_dump($_GET);
094+       var_dump($_POST);
095+       break;
096+     case 'referer':
097+       echo $_SERVER['HTTP_REFERER'];
098+       break;
099+     case 'useragent':
100+       echo $_SERVER['HTTP_USER_AGENT'];
101+       break;
102+     case 'httpversion':
103+       echo $_SERVER['SERVER_PROTOCOL'];
104+       break;
105+     case 'cookie':
106+       echo $_COOKIE['foo'];
107+       break;
108+     case 'encoding':
109+       echo $_SERVER['HTTP_ACCEPT_ENCODING'];
110+       break;
111+     case 'contenttype':
112+       header('Content-Type: text/plain;charset=utf-8');
113+       break;
114+     case 'file':
115+       if (isset($_FILES['file'])) {
116+           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
117+       }
118+       break;
119+     case 'method':
120+       echo $_SERVER['REQUEST_METHOD'];
121+       break;
122+     default:
123+       echo "Hello World!\n";
124+       echo "Hello World!";
125+       break;
126+   }
127+ ?>
128+ "
129+ ===DONE===

 

Generated at Mon, 14 Jan 2019 03:56:25 +0000 (4 days ago)

Copyright © 2005-2019 The PHP Group
All rights reserved.