|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27187 fpassthru seems to not be binary safe
Submitted: 2004-02-08 21:57 UTC Modified: 2004-02-15 08:59 UTC
From: php at brokep dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.0.0b3 (beta3) OS: Tru64 v5.0a
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: php at brokep dot com
New email:
PHP Version: OS:


 [2004-02-08 21:57 UTC] php at brokep dot com
While trying this code, my webpage was outputted as empty:

$fp=fopen("windowsfile.exe", "rb");

If I instead used echo the data i fread() it was no problem.
I tried fpassthru() with ELF-binaries and this was not a problem, only with the windows-binary file.

Reproduce code:


Expected result:
the contents of the $client-file

Actual result:
An empty webpage.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-08 22:21 UTC]
Which web server implementation are you using? (eg. 
Apache) and what is the version of it? (eg. 2.0.40)

And could you try it on the CLI version of PHP again?

 [2004-02-09 01:04 UTC] php at brokep dot com
PHP compililation flags:
./configure --with-apxs2=/apache/bin/apxs --with-mysql=/usr/local/mysql
--enable-track-vars --enable-inline-optimization --with-xml
--with-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg
--with-gettext --with-xslt --with-imap=/usr/local/imap

PHP 5.0.0b3
Apache2, 2.0.48
MySQL 5.0
newest libxml, libxslt, imap-2002e.

I tried the commandline PHP and - surprise - it worked like it should.
I can send you both the php-code and the win32binary that makes it not work.
 [2004-02-09 01:22 UTC]
1) If any of the following features is turned on in your php.ini, turn them off and try again.

 . output_handler=...
 . session.use_trans_sid=...
 . output_buffering=...

2) Try using file_get_contents() instead and see what'll happen.

echo file_get_contents('<your-cursed-win32-binary>");

 [2004-02-09 02:02 UTC] php at brokep dot com
1. None of them are (nor was) activated.
2. file_get_contents() worked.

Is my binary a black hole? :)
 [2004-02-09 05:01 UTC]
OK, well, then check out your error_log. Is there any 
weird entry that starts with "Segmentation Fault", "bus 
error" or whatsoever you don't see unless fpassthru() is 

If you find anything alike, then generate a backtrace 
with an appropriate debugger installed in your system. might 
be helpful.

 [2004-02-15 08:59 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 21:01:23 2020 UTC