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_multi_getcontent_basic3.phpt ('Curl_multi_getcontent() basic test with different sources (local file/http)')

Script

1: <?php
2:     
//CURL_MULTI_GETCONTENT TEST
3:
4:     //CREATE RESOURCES
5:      
$ch1=curl_init();
6:     
$ch2=curl_init();
7:
8:     
//SET URL AND OTHER OPTIONS
9:     
include 'server.inc';
10:     
$host curl_cli_server_start();
11:     
curl_setopt($ch1CURLOPT_URL"{$host}/get.inc?test=getpost&get_param=Hello%20World");
12:     
curl_setopt($ch2CURLOPT_URL"file://".dirname(__FILE__). DIRECTORY_SEPARATOR "curl_testdata2.txt");
13:     
curl_setopt($ch1CURLOPT_RETURNTRANSFERtrue);
14:     
curl_setopt($ch2CURLOPT_RETURNTRANSFERtrue);
15:
16:     
//CREATE MULTIPLE CURL HANDLE
17:     
$mh=curl_multi_init();
18:
19:     
//ADD THE 2 HANDLES
20:     
curl_multi_add_handle($mh,$ch1);
21:     
curl_multi_add_handle($mh,$ch2);
22:
23:     
//EXECUTE
24:     
$running=0;
25:     do {
26:         
curl_multi_exec($mh,$running);
27:     } while (
$running>0);
28:
29:     
$results1=curl_multi_getcontent($ch1);
30:         
$results2=curl_multi_getcontent($ch2);
31:
32:     
//CLOSE
33:      
curl_multi_remove_handle($mh,$ch1);
34:     
curl_multi_remove_handle($mh,$ch2);
35:     
curl_multi_close($mh);
36:
37:     echo 
$results1;
38:     echo 
$results2;
39:
40:
?>
41:

Expected

array(2) {
  ["test"]=>
  string(7) "getpost"
  ["get_param"]=>
  string(11) "Hello World"
}
array(0) {
}
CURL2

Output

<?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;
  }
?>
CURL2

Diff

001+ <?php
002+   $test = isset($_GET['test']) ? $_GET['test'] : null;
003+   switch($test) {
004+     case 'post':
005+       var_dump($_POST);
006+       break;
007+     case 'getpost':
008+       var_dump($_GET);
009+       var_dump($_POST);
001- array(2) {
002-   ["test"]=>
003-   string(7) "getpost"
004-   ["get_param"]=>
005-   string(11) "Hello World"
006- }
007- array(0) {
008- }
009- CURL2
010+       break;
011+     case 'referer':
012+       echo $_SERVER['HTTP_REFERER'];
013+       break;
014+     case 'useragent':
015+       echo $_SERVER['HTTP_USER_AGENT'];
016+       break;
017+     case 'httpversion':
018+       echo $_SERVER['SERVER_PROTOCOL'];
019+       break;
020+     case 'cookie':
021+       echo $_COOKIE['foo'];
022+       break;
023+     case 'encoding':
024+       echo $_SERVER['HTTP_ACCEPT_ENCODING'];
025+       break;
026+     case 'contenttype':
027+       header('Content-Type: text/plain;charset=utf-8');
028+       break;
029+     case 'file':
030+       if (isset($_FILES['file'])) {
031+           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
032+       }
033+       break;
034+     case 'method':
035+       echo $_SERVER['REQUEST_METHOD'];
036+       break;
037+     default:
038+       echo "Hello World!\n";
039+       echo "Hello World!";
040+       break;
041+   }
042+ ?>
043+ CURL2

 

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

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