Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » Questions about Stars! AutoHost » Editing an empty post (split off)
Editing an empty post (split off) Sat, 29 July 2006 04:53 Go to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Hey, I got this while editing an empty post:

Warning: fread(): Length parameter must be greater than 0. in /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php:42) in /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php on line 3631


[Updated on: Sat, 29 July 2006 04:57]




So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Mid-game gateable missle defence reserve Sat, 05 August 2006 22:30 Go to previous messageGo to next message
Ron is currently offline Ron

 
Commander
Forum Administrator
Stars! AutoHost Administrator

Messages: 1232
Registered: October 2002
Location: Collegedale, TN
m.a@stars wrote on Sat, 29 July 2006 04:53

Hey, I got this while editing an empty post:

Warning: fread(): Length parameter must be greater than 0. in /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php:42) in /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php on line 3631

Yes, I know... don't know what causes it.



Ron Miller
Stars! AutoHost

Report message to a moderator

Re: Mid-game gateable missle defence reserve Mon, 07 August 2006 01:43 Go to previous messageGo to next message
multilis is currently offline multilis

 
Lt. Commander

Messages: 789
Registered: October 2003
Location: Edmonton, Canada
Likely moderator will split this topic off, thanks in advance. Smile

Ron wrote on Sat, 05 August 2006 20:30

m.a@stars wrote on Sat, 29 July 2006 04:53

Hey, I got this while editing an empty post:

Warning: fread(): Length parameter must be greater than 0. in /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php:42) in /var/www/autohost.cathey.us/htdocs/sahforum/theme/Stars/post .php on line 3631

Yes, I know... don't know what causes it.


A post with no content, only a subject and maybe a poll gets this error if you try to edit it. Line 42 of post.php likely needs a small change by adding an "if size>0" type statement. My php is rusty, but from my php help file:

Quote:

fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when length bytes have been read, EOF (end of file) is reached, or (for network streams) when a packet becomes available, whichever comes first.

<?php
// get contents of a file into a string
$filename = "/usr/local/something.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>


The above sample to avoid similar problem might be changed to:
Quote:


<?php
// get contents of a file into a string
$filename = "/usr/local/something.txt";
$handle = fopen($filename, "r");
$readsize = filesize($filename);

if ($readsize>0)
{
$contents = fread($handle, filesize($filename));
}
else
{
$contents = "";
}
fclose($handle);
?>



A change similar in style to this to line 42 of post.php may get rid of first warning.

Some other minor tweak to line 42 may get rid of second warning, hard to say exactly without seeing source code, but one option is to fake having something if nothing, eg
Quote:

else { contents="X"; }
rather than
Quote:

else { contents=""; }


{Mod edit: fixed quote}


[Updated on: Mon, 07 August 2006 02:48] by Moderator


Report message to a moderator

Re: Editing an empty post (split off) Mon, 07 August 2006 02:47 Go to previous message
Micha

 

Messages: 2342
Registered: November 2002
Location: Belgium GMT +1
multilis wrote on Mon, 07 August 2006 07:43

Likely moderator will split this topic off, thanks in advance. Smile

Yup! Smile
(thanks to Ashlyn for the pointer <g>)

mch,
modaw

Report message to a moderator

Previous Topic: Game pages on hold
Next Topic: Long Posts
Goto Forum:
  


Current Time: Sat Jun 22 18:47:16 EDT 2024