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_018.phpt ('Test curl_setopt() with curl_multi function with basic functionality')

Script

1: <?php
2:
/* Prototype  : bool curl_setopt(resource ch, int option, mixed value)
3:  * Description: Set an option for a cURL transfer
4:  * Source code: ext/curl/interface.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:   
$options = array(
24:     
CURLOPT_RETURNTRANSFER => 1,
25:     
CURLOPT_URL => $url,
26:   );
27:
28:   
curl_setopt_array($chs[0], $options); //set the options
29:   
curl_setopt_array($chs[1], $options); //set the options
30:   
curl_setopt_array($chs[2], $options); //set the options
31:
32:   
$mh curl_multi_init();
33:
34:   
// add handlers
35:   
curl_multi_add_handle($mh$chs[0]);
36:   
curl_multi_add_handle($mh$chs[1]);
37:   
curl_multi_add_handle($mh$chs[2]);
38:
39:   
$running=null;
40:   
//execute the handles
41:   
do {
42:     
curl_multi_exec($mh$running);
43:   } while (
$running 0);
44:
45:   
$curl_content '';
46:   
$curl_content .= curl_multi_getcontent($chs[0]);
47:   
$curl_content .= curl_multi_getcontent($chs[1]);
48:   
$curl_content .= curl_multi_getcontent($chs[2]);
49:
50:   
//close the handles
51:   
curl_multi_remove_handle($mh$chs[0]);
52:   
curl_multi_remove_handle($mh$chs[1]);
53:   
curl_multi_remove_handle($mh$chs[2]);
54:   
curl_multi_close($mh);
55:
56:   
var_dump$curl_content );
57:
58:
?>
59:
===DONE===
60:

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, 06 May 2019 17:58:35 +0000 (50 days ago)

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