A strange bug for 1.8.1+

A strange bug for 1.8.1+

by sho yong -
Number of replies: 2
I am using Moodle 1.8.1+ and encountered a strange bug.

I am testing Moodle on my notebook. My system configurations are as follows.
WinXP SP2
Apache 2.2.4
PHP 5.2.3
Mysql 4.1.20
Moodle 1.8.1+ (2007.6.18 build)

Symptom:
I, no matter as the admin or a teacher, can upload files in a course. The uploaded files are perfectly fine. I checked those files in the $moodledata\$courseid folder. They can be opened or played by applications.

But, when I insert a resource in a course using these uploaded files, some of the files can be shown or played but others just won't show!!!!

So I checked very carefully every step in my operations and finally found out what went wrong ---- if I download every file through file.php, every downloaded file will be 2 bytes longer than the original file. I then checked these downloaded files with original files in Ultraedit and found out that a crlf (HEX:0D0A or \r\n) had been added to the very beginning of these files!!!! The particularly annoying thing about this is that it will not break EVERY type of files, but some or most types of files WILL suffer!!

So far, I have tested 10 types of files.
1. plain text files(.txt) will be shown in the browser. If downloaded, a new blank line is added to the beginning of the file. It is just fine, I think.

2. HTML files(.htm or .html) will be shown in the browser. If downloaded, a new blank line is added to the beginning of the source file. But it is invisible in browsers.

3. Acrobat reader files(.pdf) will be shown in the browser through the plug-in if you have acrobat reader installed. If downloaded, a new blank line is added to the beginning of the source file. But acrobat reader just renders this file quite happily.

4. MP3 files(.mp3) will be played back in the browser through the flash mp3 player. If downloaded, a new blank line is added to the beginning of the source file. But winamp or windows media player will just play back the file.

5. ZIP files(.zip) will always be downloaded by the browser. If downloaded, a new blank line is added to the beginning of the source file. But winrar can open and unzip the file without complaining.

6. Wave form files(.wav) will be shown the browser in TEXT format!! If downloaded, a new blank line is added to the beginning of the source file and the file is corrupted -- no program can play it. I tried windows media player and media player classic. No luck!

7. JPEG files(.jpg) CANNOT be shown in the browser!! All I get is a red cross. If downloaded, a new blank line is added to the beginning of the source file. The interesting thing is that ACDSEE can happily show this image. but windows draw cannot render this file!! So it depends on the error tolerance of applications.

8. Power point files(.pps) will be shown the browser in TEXT format!! If downloaded, a new blank line is added to the beginning of the source file and the file is corrupted. Power point CAN open it but the first page is blank white, the second page is white with garble code on it and then it's over.

9. Word files(.doc) will be shown the browser in TEXT format!! If downloaded, a new blank line is added to the beginning of the source file and the file is corrupted. If I try to open it, Word will ask me to pick a character set for this file and I just can't find the correct one!

10. AVI files(.avi) cannot be shown in the browser through plug-in. If downloaded, a new blank line is added to the beginning of the source file and the file is corrupted. Neither windows media player nor media player classic can play it.

So my solution for now is zip EVERYTHING I upload! Then download and unzip. But can anyone tell me how to fix this bug??
Average of ratings: Useful (1)
In reply to sho yong

Re: A strange bug for 1.8.1+

by Judy Hsu -
Ah I guess you are using some non-latin (double-byted) language for 1.8.1+, correct?
In reply to sho yong

Re: A strange bug for 1.8.1+

by Mauno Korpelainen -

It could be possible too that config.php has some unwanted characters like spaces after last characters

?>