#23360 [NEW]: passthru probably modifies data
| From: | gerlach-rainer at gmx dot de | Date: | Sat, 26 Apr 2003 11:13:50 +0000 |
| Subject: | #23360 [NEW]: passthru probably modifies data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-38440@lists.php.net to get a copy of this message | ||
From: gerlach-rainer at gmx dot de
Operating system: FreeBSD 4.7-RC
PHP version: 4.3.1
PHP Bug Type: Unknown/Other Function
Bug description: passthru probably modifies data
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 bug report at http://bugs.php.net/?id=23360&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23360&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23360&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23360&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23360&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23360&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23360&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23360&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23360&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23360&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23360&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23360&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23360&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23360&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23360&r=gnused