Skip to content

Instantly share code, notes, and snippets.

@Taluu
Last active April 10, 2019 08:34
Show Gist options
  • Save Taluu/50aa950b4fcfd5997f69e1d11ead6cdf to your computer and use it in GitHub Desktop.
Save Taluu/50aa950b4fcfd5997f69e1d11ead6cdf to your computer and use it in GitHub Desktop.
reproducer for symfony/symfony#30753
{
"require": {
"symfony/http-client": "^4.3@dev"
},
"require-dev": {
"symfony/var-dumper": "^4.3@dev"
},
"minimum-stability": "dev"
}
<?php declare(strict_types=1);
use Symfony\Component\HttpClient\HttpClient;
require __DIR__ . '/vendor/autoload.php';
$client = HttpClient::create();
$r = $client->request(
'POST',
'http://localhost:8081',
[
'auth_bearer' => 'foobaba',
'headers' => [
'Content-Type' => 'application/json',
],
'body' => json_encode(['foo' => 'bar']),
]
);
if ($argv[1] ?? false) {
dump($r->getStatusCode());
}
<?php
header('Content-Type: application/json+ld');
header("HTTP/1.1 500 Internal Server Error");
echo <<<JSON
[
{
"foo": "bar"
},
{
"foo": {"baz": "baz"}
},
{
"foo": [1, 2, 3]
}
]
JSON;
@Taluu
Copy link
Author

Taluu commented Mar 28, 2019

How to use ;

  • composer install
  • launch php -S localhost:8081 server.php
  • launch php reproducer.php, it should throw the failed writing headers from the TransportException
  • launch php reproducer.php foo, it should dump 500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment