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_copy_handle_basic_006.phpt ('Test curl_copy_handle() with User Agent')

Script

1: <?php
2:
3:   
include 'server.inc';
4:   
$host curl_cli_server_start();
5:
6:   echo 
'*** Testing curl copy handle with User Agent ***' "\n";
7:
8:   
$url "{$host}/get.inc?test=useragent";
9:   
$ch curl_init();
10:
11:   
ob_start(); // start output buffering
12:   
curl_setopt($chCURLOPT_RETURNTRANSFER1);
13:   
curl_setopt($chCURLOPT_USERAGENT'cURL phpt');
14:   
curl_setopt($chCURLOPT_URL$url); //set the url we want to use
15:
16:   
$copy curl_copy_handle($ch);
17:
18:   
var_dumpcurl_exec($ch) );
19:   
var_dumpcurl_exec($copy) );
20:
21:   
curl_close($ch); // can not close original handle before curl_exec($copy) since it causes char * inputs to be invalid (see also: http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html)
22:   
curl_close($copy);
23:
24:
?>
25:
===DONE===
26:

Expected

*** Testing curl copy handle with User Agent ***
string(9) "cURL phpt"
string(9) "cURL phpt"
===DONE===

Output

*** Testing curl copy handle with User Agent ***
string(973) "<?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(973) "<?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(973) "<?php
003+   $test = isset($_GET['test']) ? $_GET['test'] : null;
004+   switch($test) {
002- string(9) "cURL phpt"
003- string(9) "cURL phpt"
004- ===DONE===
005+     case 'post':
006+       var_dump($_POST);
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+ "
045+ string(973) "<?php
046+   $test = isset($_GET['test']) ? $_GET['test'] : null;
047+   switch($test) {
048+     case 'post':
049+       var_dump($_POST);
050+       break;
051+     case 'getpost':
052+       var_dump($_GET);
053+       var_dump($_POST);
054+       break;
055+     case 'referer':
056+       echo $_SERVER['HTTP_REFERER'];
057+       break;
058+     case 'useragent':
059+       echo $_SERVER['HTTP_USER_AGENT'];
060+       break;
061+     case 'httpversion':
062+       echo $_SERVER['SERVER_PROTOCOL'];
063+       break;
064+     case 'cookie':
065+       echo $_COOKIE['foo'];
066+       break;
067+     case 'encoding':
068+       echo $_SERVER['HTTP_ACCEPT_ENCODING'];
069+       break;
070+     case 'contenttype':
071+       header('Content-Type: text/plain;charset=utf-8');
072+       break;
073+     case 'file':
074+       if (isset($_FILES['file'])) {
075+           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
076+       }
077+       break;
078+     case 'method':
079+       echo $_SERVER['REQUEST_METHOD'];
080+       break;
081+     default:
082+       echo "Hello World!\n";
083+       echo "Hello World!";
084+       break;
085+   }
086+ ?>
087+ "
088+ ===DONE===

 

Generated at Mon, 06 May 2019 17:58:35 +0000 (50 days ago)

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