#23360 [Opn->Fbk]: passthru probably modifies data

From: Date: Sat, 26 Apr 2003 19:05:13 +0000
Subject: #23360 [Opn->Fbk]: passthru probably modifies data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38465@lists.php.net to get a copy of this message
ID: 23360 Updated by: pollita@php.net Reported By: gerlach-rainer at gmx dot de -Status: Open +Status: Feedback Bug Type: Unknown/Other Function Operating System: FreeBSD 4.7-RC PHP Version: 4.3.1 New Comment: It may be the webserver doing the data manipulation, try explicitly setting the content encoding: header('Content-encoding: 8bit'); header('Content-transfer-encoding: 8bit'); Previous Comments: ------------------------------------------------------------------------ [2003-04-26 06:24:02] gerlach-rainer at gmx dot de I write a little application that converts u-law sound files on the fly to wave and sends the out- put to the browser (IE6 on Windows XP). I use mod_php4 on Apache/1.3.12 (Unix). example script (lines splitted at _ for better readability): <?PHP if (isset($_GET['call'])) { header("Content-type: audio/x-wav"); passthru( _ "cat /var/isdn/" . $_GET['call'] . " | _ /usr/sbin/g711conv -a | _ /usr/local/bin/sox -t ul - -t wav -"); } ?> The file is played, but at the end the voice output is choppy and the media player reports an "unsupported format" error. I have tested the command line on the remote machine and get a file that is correctly played by media player. I saved the link target and compared the result with the original file, created on the remote machine. They have exact the same length and almost the same content, but have little differences at the beginning. Here is the beginning of each file: orig: 00000000 5249 4646 2478 0100 5741 5645 666d 7420 RIFF$x..WAVEfmt 00000010 1000 0000 0700 0100 401f 0000 401f 0000 ........@...@... 00000020 0100 0800 6461 7461 0078 0100 f1fd 79f7 ....data.x..q}yw after passthru: 00000000 5249 4646 ffff ff7f 5741 5645 666d 7420 RIFF....WAVEfmt 00000010 1000 0000 0700 0100 401f 0000 401f 0000 ........@...@... 00000020 0100 0800 6461 7461 dbff ff7f f1fd 79f7 ....data[...q}yw I also tested to download the file with - wget from cygwin -> wrong - wget from the same machine as the webserver -> wrong this works: <?PHP if (isset($_GET['call'])) { header("Content-type: audio/x-wav"); exec(_ "cat /var/isdn/" . $_GET['call'] . " | _ /usr/sbin/g711conv -a | _ /usr/local/bin/sox -t ul - -t wav /tmp/call.wav"); $fd=fopen ("/tmp/call.wav", "r"); fpassthru($fd); } ?> ------------------------------------------------------------------------ [2003-04-26 06:13:50] gerlach-rainer at gmx dot de I write a little application that converts u-law sound files on the fly to wave and sends the out- put to the browser (IE6 on Windows XP). I use mod_php4 on Apache/1.3.12 (Unix). example script (lines splitted at _ for better readability): <?PHP if (isset($_GET['call'])) { header("Content-type: audio/x-wav"); passthru( _ "cat /var/isdn/" . $_GET['call'] . " | _ /usr/sbin/g711conv -a | _ /usr/local/bin/sox -t ul - -t wav -"); } ?> The file is played, but at the end the voice output is choppy and the media player reports an "unsupported format" error. I have tested the command line on the remote machine and get a file that is correctly played by media player. I downloaded the file with IE 6 and compared it with the original file, created on the remote machine. They have exact the length and almost the same content, but have little differences at the beginning. Here is the beginning of each file: orig: 00000000 5249 4646 2478 0100 5741 5645 666d 7420 RIFF$x..WAVEfmt 00000010 1000 0000 0700 0100 401f 0000 401f 0000 ........@...@... 00000020 0100 0800 6461 7461 0078 0100 f1fd 79f7 ....data.x..q}yw after passthru: 00000000 5249 4646 ffff ff7f 5741 5645 666d 7420 RIFF....WAVEfmt 00000010 1000 0000 0700 0100 401f 0000 401f 0000 ........@...@... 00000020 0100 0800 6461 7461 dbff ff7f f1fd 79f7 ....data[...q}yw I also tested to download the file with - wget from cygwin -> wrong - wget from the same machine as the webserver -> wrong this works: <?PHP if (isset($_GET['call'])) { header("Content-type: audio/x-wav"); exec(_ "cat /var/isdn/" . $_GET['call'] . " | _ /usr/sbin/g711conv -a | _ /usr/local/bin/sox -t ul - -t wav /tmp/call.wav"); $fd=fopen ("/tmp/call.wav", "r"); fpassthru($fd); } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23360&edit=1

« previous php.bugs (#38465) next »