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/bug66109.phpt ('Bug #66109 (Option CURLOPT_CUSTOMREQUEST can't be reset to default.)')

Script

1: <?php
2:
include 'server.inc';
3:
$host curl_cli_server_start();
4:
$ch curl_init();
5:
curl_setopt($chCURLOPT_URL"{$host}/get.inc?test=method");
6:
curl_setopt($chCURLOPT_RETURNTRANSFER1);
7:
8:
curl_setopt($chCURLOPT_CUSTOMREQUEST'DELETE');
9:
var_dump(curl_exec($ch));
10:
11:
curl_setopt($chCURLOPT_CUSTOMREQUESTNULL);
12:
var_dump(curl_exec($ch));
13:
14:
curl_close($ch);
15:
16:
?>
17:

Expected

string(6) "DELETE"
string(3) "GET"

Output

string(241) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method DELETE is not allowed for the URL /responder/get.inc.</p>
</body></html>
"
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;
  }
?>
"

Diff

001+ string(241) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
002+ <html><head>
001- string(6) "DELETE"
002- string(3) "GET"
003+ <title>405 Method Not Allowed</title>
004+ </head><body>
005+ <h1>Method Not Allowed</h1>
006+ <p>The requested method DELETE is not allowed for the URL /responder/get.inc.</p>
007+ </body></html>
008+ "
009+ string(973) "<?php
010+   $test = isset($_GET['test']) ? $_GET['test'] : null;
011+   switch($test) {
012+     case 'post':
013+       var_dump($_POST);
014+       break;
015+     case 'getpost':
016+       var_dump($_GET);
017+       var_dump($_POST);
018+       break;
019+     case 'referer':
020+       echo $_SERVER['HTTP_REFERER'];
021+       break;
022+     case 'useragent':
023+       echo $_SERVER['HTTP_USER_AGENT'];
024+       break;
025+     case 'httpversion':
026+       echo $_SERVER['SERVER_PROTOCOL'];
027+       break;
028+     case 'cookie':
029+       echo $_COOKIE['foo'];
030+       break;
031+     case 'encoding':
032+       echo $_SERVER['HTTP_ACCEPT_ENCODING'];
033+       break;
034+     case 'contenttype':
035+       header('Content-Type: text/plain;charset=utf-8');
036+       break;
037+     case 'file':
038+       if (isset($_FILES['file'])) {
039+           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
040+       }
041+       break;
042+     case 'method':
043+       echo $_SERVER['REQUEST_METHOD'];
044+       break;
045+     default:
046+       echo "Hello World!\n";
047+       echo "Hello World!";
048+       break;
049+   }
050+ ?>
051+ "

 

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

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