FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » PM:s get length=0
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PM:s get length=0 [message #11745] Wed, 16 July 2003 13:18 Go to next message
sverre is currently offline  sverre   Sweden
Messages: 11
Registered: February 2002
Karma: 0
Junior Member
Hi. I'm running 2.3.2 on a FreeBSD machine and yesterday the PM:s sent started not to have any message body. The text gets written into the file, and the table fud_pmsg seems to be correctly updated, except that length is set to 0.
Any ideas what this may be?
The problem appeared after I upgraded the machine to newest mod_php4, so I suspect that is a part of the problem... but how?
Re: PM:s get length=0 [message #11746 is a reply to message #11745] Wed, 16 July 2003 14:03 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
First of all try upgrading to 2.3.9RC1 (latest release in the 2.3.X) branch and try again, unless you can/want to upgrade to 2.5.0.
The problem could the result of fwrite or ftell not returning the correct result, but rather returning 0. This a a problem you occasionaly see on systems where there is a limit on the maximum size a file can grow to.
One thing you could try, is to run a message compactor, which will remove some of the unneeded stuff from the data files (where message bodies) are stored reducing their size.


FUDforum Core Developer
Re: PM:s get length=0 [message #11749 is a reply to message #11745] Wed, 16 July 2003 14:15 Go to previous messageGo to next message
sverre is currently offline  sverre   Sweden
Messages: 11
Registered: February 2002
Karma: 0
Junior Member
I found the problem. By adding "fseek($fp,0,SEEK_END);" to ppost.php/write_pmsg_body() before ftell is used for the first time, the problem disapeared. Seems that the behavior of ftell had changed slightly in the newest php4.

I will soon upgrade to 2.5.0 I think (can see no reason not to).
Thanks
Re: PM:s get length=0 [message #11751 is a reply to message #11749] Wed, 16 July 2003 14:28 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Which version of php4 are you using now and which version were you using beforfe?

I do see how your addition fixes the problem, you force php to go to the end of the file. However this operation should not be necessary since
<?php
fopen
("file", "ab");
?>

should place the file pointer at the end of the file.

Since this sort of an addition is not in 2.5.0 you can for now hold off upgrading while I investiage this issue further.

Meanwhile please try the following test script and let me know what are the results.
<?php
$fp
= fopen("test", "w");
fwrite($fp, str_repeat("abc", 1024));
fclose($fp);

$fp = fopen("test", "a");
echo
"Before fseek()\n";
var_dump(ftell($fp), filesize("test"));
fseek($fp, 0, SEEK_END);
echo
"After fseek()\n";
var_dump(ftell($fp), filesize("test"));
fclose($fp);
?>


FUDforum Core Developer
Re: PM:s get length=0 [message #11752 is a reply to message #11745] Wed, 16 July 2003 14:50 Go to previous messageGo to next message
sverre is currently offline  sverre   Sweden
Messages: 11
Registered: February 2002
Karma: 0
Junior Member
Here's the result of yout test script:
Before fseek() int(0) int(3072) After fseek() int(3072) int(3072)

I am currently using mod_php4-4.3.3_RC1, but I have no idea what I had before (but I know it was new about 90 days ago).


Re: PM:s get length=0 [message #11753 is a reply to message #11752] Wed, 16 July 2003 14:53 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Hmm that's the same version I am using as well... and interestingly enough I was able to replicate the problem on linux as well.

For now do not upgrade I will investigate the issue further to determine if this is a PHP bug or intended behaviour (comments in php manual by other users indicate that this was the case for a while now) and consider an appropriate solution. For now, use your fix and keep an eye for the 2.5.1 release, which will definately have some sort of a solution to this problem.


FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Forum borked after rebuilding theme
Next Topic: Private msgs Online indicator fix
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 14:10:55 GMT 2024

Total time taken to generate the page: 0.02004 seconds