#27187 [Opn->Fbk]: fpassthru seems to not be binary safe

From: Date: Mon, 09 Feb 2004 06:22:01 +0000
Subject: #27187 [Opn->Fbk]: fpassthru seems to not be binary safe
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54595@lists.php.net to get a copy of this message
ID: 27187 Updated by: moriyoshi@php.net Reported By: php at brokep dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Tru64 v5.0a PHP Version: 5.0.0b3 (beta3) New Comment: 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. <?php echo file_get_contents('<your-cursed-win32-binary>"); ?> Previous Comments: ------------------------------------------------------------------------ [2004-02-09 01:04:00] php at brokep dot com PHP compililation flags: --CUT-- ./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 --CUT-- Versions: 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-08 22:21:25] moriyoshi@php.net 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-08 21:57:05] php at brokep dot com Description: ------------ While trying this code, my webpage was outputted as empty: $fp=fopen("windowsfile.exe", "rb"); fpassthru($fp); 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: --------------- $client="/a/win32/binary/file.exe"; $fs=filesize($client); $fp=fopen($client,"rb"); fpassthru($fp); Expected result: ---------------- the contents of the $client-file Actual result: -------------- An empty webpage. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27187&edit=1

« previous php.bugs (#54595) next »