HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //usr/share/pear/test/pecl_http/tests/info_001.phpt
--TEST--
invalid HTTP info
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php

try { 
    var_dump(new http\Message("GET HTTP/1.1"));
} catch (Exception $e) {
    echo $e, "\n";
}
try { 
    var_dump(new http\Message("GET HTTP/1.123"));
} catch (Exception $e) {
    echo $e, "\n";
}
try { 
    var_dump(new http\Message("GETHTTP/1.1"));
} catch (Exception $e) {
    echo $e, "\n";
}
var_dump(new http\Message("GET / HTTP/1.1"));
?>
DONE
--EXPECTF--
exception 'http\Exception\BadMessageException' with message 'Could not parse message: GET HTTP/1.1' in %s
Stack trace:
#0 %s: http\Message->__construct('GET HTTP/1.1')
#1 {main}
exception 'http\Exception\BadMessageException' with message 'Could not parse message: GET HTTP/1.123' in %s
Stack trace:
#0 %s: http\Message->__construct('GET HTTP/1.123')
#1 {main}
exception 'http\Exception\BadMessageException' with message 'Could not parse message: GETHTTP/1.1' in %s
Stack trace:
#0 %s: http\Message->__construct('GETHTTP/1.1')
#1 {main}
object(http\Message)#%d (9) {
  ["type":protected]=>
  int(1)
  ["body":protected]=>
  object(http\Message\Body)#%d (0) {
  }
  ["requestMethod":protected]=>
  string(3) "GET"
  ["requestUrl":protected]=>
  string(1) "/"
  ["responseStatus":protected]=>
  string(0) ""
  ["responseCode":protected]=>
  int(0)
  ["httpVersion":protected]=>
  string(3) "1.1"
  ["headers":protected]=>
  array(0) {
  }
  ["parentMessage":protected]=>
  NULL
}
DONE