Test Failure Report for ext/curl/tests/bug27023.phpt ('Bug #27023 (CURLOPT_POSTFIELDS does not parse content types for files)')
Script
1:
<?php 2: 3: $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER'); 4: $ch = curl_init(); 5: curl_setopt($ch, CURLOPT_URL, "{$host}/get.php?test=file"); 6: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 7: 8: $params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt'); 9: curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 10: var_dump(curl_exec($ch)); 11: 12: $params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;type=text/plain'); 13: curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 14: var_dump(curl_exec($ch)); 15: 16: $params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;filename=foo.txt'); 17: curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 18: var_dump(curl_exec($ch)); 19: 20: $params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;type=text/plain;filename=foo.txt'); 21: curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 22: var_dump(curl_exec($ch)); 23: 24: $params = array('file' => '@' . __DIR__ . '/curl_testdata1.txt;filename=foo.txt;type=text/plain'); 25: curl_setopt($ch, CURLOPT_POSTFIELDS, $params); 26: var_dump(curl_exec($ch)); 27: 28: 29: curl_close($ch); 30: ?> 31:
Expected
string(%d) "curl_testdata1.txt|application/octet-stream"
string(%d) "curl_testdata1.txt|text/plain"
string(%d) "foo.txt|application/octet-stream"
string(%d) "foo.txt|text/plain"
string(%d) "foo.txt|text/plain"
Output
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
Diff
001+ string(0) ""
002+ string(0) ""
003+ string(0) ""
004+ string(0) ""
005+ string(0) ""
001- string(%d) "curl_testdata1.txt|application/octet-stream"
002- string(%d) "curl_testdata1.txt|text/plain"
003- string(%d) "foo.txt|application/octet-stream"
004- string(%d) "foo.txt|text/plain"
005- string(%d) "foo.txt|text/plain"
Generated at Fri, 17 May 2013 23:23:52 +0000 (7 days ago)
|