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_021.phpt ('Test curl_getinfo() function with CURLINFO_CONTENT_TYPE parameter')

Script

1: <?php
2:   
include 'server.inc';
3:   
$host curl_cli_server_start();
4:   
$url  "{$host}/get.inc?test=contenttype";
5:
6:   
$ch curl_init();
7:   
curl_setopt($chCURLOPT_URL$url);
8:   
curl_exec($ch);
9:   
var_dump(curl_getinfo($chCURLINFO_CONTENT_TYPE));
10:   
curl_close($ch);
11:
?>
12:
===DONE===
13:

Expected

string(24) "text/plain;charset=utf-8"
===DONE===

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;
  }
?>
string(25) "text/plain; charset=UTF-8"
===DONE===

Diff

001+ <?php
002+   $test = isset($_GET['test']) ? $_GET['test'] : null;
001- string(24) "text/plain;charset=utf-8"
002- ===DONE===
003+   switch($test) {
004+     case 'post':
005+       var_dump($_POST);
006+       break;
007+     case 'getpost':
008+       var_dump($_GET);
009+       var_dump($_POST);
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+ string(25) "text/plain; charset=UTF-8"
044+ ===DONE===

 

Generated at Tue, 19 Mar 2019 00:18:08 +0000 (4 days ago)

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