Bug #80282 [Fbk->Asn]: cannot send binary data to popen
| From: | vanherkmarcel at gmail dot com | Date: | Mon, 26 Oct 2020 21:58:29 +0000 |
| Subject: | Bug #80282 [Fbk->Asn]: cannot send binary data to popen | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229931@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80282&edit=1
ID: 80282
User updated by: vanherkmarcel at gmail dot com
Reported by: vanherkmarcel at gmail dot com
Summary: cannot send binary data to popen
-Status: Feedback
+Status: Assigned
Type: Bug
Package: Filesystem function related
Operating System: Windows
PHP Version: 7.4.11
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Hi,
Thanks for trying.
I lost my test code, since I programmed around it. My exe is the CGI interface of a DICOM server
(Conquest DICOM server), and I was using php to forward a POST request to is CGI client dgate.exe.
By default popen($exe, "w") opens in text mode on Windows - this is not documented.
popen($exe, "wb") is not documented either, and when I tried it did seem not start my exe.
There may have been a mixup with PHP versions though.
Marcel
Previous Comments:
------------------------------------------------------------------------
[2020-10-26 16:17:44] cmb@php.net
> popen($exe, 'wb') fails
I cannot reproduce that. What exactly fails? Is there some error
message? Which executable do you call?
------------------------------------------------------------------------
[2020-10-24 18:19:31] vanherkmarcel at gmail dot com
Description:
------------
I am attempting to send binary data to a process openened with popen under windows. However, any
0x0a is appended with a 0x0d, and there is no option to turn this of: popen($exe, 'wb')
fails.
Test script:
---------------
$handle = popen($exe, 'w');
fwrite($handle, file_get_contents($_FILES['filetoupload']['tmp_name']));
pclose($handle)
Expected result:
----------------
Data is transmitted as is without interference
Actual result:
--------------
0x0a replaced by 0x0a 0x0d
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80282&edit=1