Results 1 to 11 of 11

Thread: Error log: PHP Warning (Length parameter must be greater than 0)

  1. #1
    Join Date
    Jan 2008
    Posts
    141

    Default Error log: PHP Warning (Length parameter must be greater than 0)

    Anyone know what this means? I found it in my error logs several times

    [Sun Apr 06 08:45:54 2008] [error] [client 83.xxx.xx.xx] PHP Warning: fread() [<a href='function.fread'>function.fread</a>]: Length parameter must be greater than 0 in /home/mywebsite/public_html/forum/bb_functions.php on line 20, referer: http://mywebsite.com/detail.php?linkid=56

  2. #2
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    that isnt indexU, thats your forum spitting up the error. looks like the script is looking for something that doesnt exist... its only a php warning nothing very serious... it happens a lot with software that was designed for php4 and is in a php5 environment, i think your using miniBB? i put a line of code on the mod for htis that suppresses errors so its only ever going to show in your logs and will cause no visual or useage problems on the forum.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  3. #3
    Join Date
    Jan 2008
    Posts
    141

    Default

    Yes I thought it could be the forum... So I shouldn't worry about this? It doesn't matter if I receive erros? I use php5

  4. #4
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    if you took the lines out of error suppression lines in application.php you would get the same thing showing up all over the place in indexu 5.4 running php5. Its a php warnign not an error... if you have something showing up on the site or not working its worth checking out but if its jsut the log i wouldnt worry too much.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  5. #5
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by inspireme View Post
    if you took the lines out of error suppression lines in application.php you would get the same thing showing up all over the place in indexu 5.4 running php5. Its a php warnign not an error... if you have something showing up on the site or not working its worth checking out but if its jsut the log i wouldnt worry too much.
    Actually, these type of errors have been around since at least v3.2 and are not specific to just PHP 5.

    dody provided almost no error detection coding in earlier versions of INDEXU. dody just assumed certain things and thus warnings and fatal errors could occur. I think some attempt has been made with v5.x to add code to detect and prevent warnings and errors.

    The problem with PHP 5 is that register_globals is turned off by default (I believe this directive was actually turned off in the more later versions of PHP 4). Many programmers, including dody, coded their programs the easy way with register_globals turned on. If the PHP you used in running INDEXU had register_globals turned off, then INDEXU would crash.

    Things are much better now for register_globals in INDEXU if for no other reason than dody was forced to deal with it (although I'm not still not 100% convinced that INDEXU is hacker safe). As for the other warnings and errors, who knows if all have been dealt with.

    Just out of curiosity, what lines are you referring to in application.php...?



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  6. #6
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    php5 outputs the warnigns to the screen, which looks pretty bad

    error_reporting(E_ERROR);

    and

    ini_set("error_reporting", E_ALL & ~E_NOTICE);


    in application.php stop it. they still show in your error log though.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  7. #7
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by inspireme View Post
    php5 outputs the warnigns to the screen, which looks pretty bad

    error_reporting(E_ERROR);

    and

    ini_set("error_reporting", E_ALL & ~E_NOTICE);


    in application.php stop it. they still show in your error log though.
    hmmmm...I don't see any error settings in the v5.4 application.php.

    the only thing I see in the v6 (beta ) is:

    error_reporting(E_ALL & ~E_NOTICE);

    of course, the above just reports warnings and errors. it is up to the programmer to prevent them.




    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  8. #8
    Join Date
    Jan 2008
    Posts
    141

    Default

    The problem is worse than just error log, when I go to: http://mywebsite.com/forum/index.php I get:

    Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/mywebsite/public_html/forum/bb_functions.php on line 20

  9. #9
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    its still jsut a warning, you need to suppress it with :
    error_reporting(E_ALL & ~E_NOTICE);

    put it in the index.php file at the top and see if it stops t.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  10. #10
    Join Date
    Jan 2008
    Posts
    141

    Default

    Hi,

    I did put "error_reporting(E_ALL & ~E_NOTICE);" on the top in the index file located in the forum folder but it didn't help. Also, this error only appear when I am not logged in

  11. #11
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by Warz View Post
    The problem is worse than just error log, when I go to: http://mywebsite.com/forum/index.php I get:

    Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/mywebsite/public_html/forum/bb_functions.php on line 20
    well, then, maybe your options are to contact the folks who write the forum software for a possible solution (I assume they have a forum where you can post a message) or edit line 20 of the bb_functions.php file.


    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

Similar Threads

  1. Increase data field length/size??
    By Vitis in forum v5.x
    Replies: 6
    Last Post: 08-23-2007, 06:52 PM
  2. Checkbox Modify Length
    By prowler in forum Blocks and Modification
    Replies: 10
    Last Post: 07-15-2007, 04:46 PM
  3. Max and min length of a text field
    By Excell in forum v5.x
    Replies: 0
    Last Post: 04-18-2007, 11:20 AM
  4. PHP Warning - Smarty Error
    By Rob in forum v5.x
    Replies: 2
    Last Post: 08-01-2006, 07:59 PM
  5. Warning: mysql_pconnect()
    By conheo in forum v5.x
    Replies: 5
    Last Post: 01-03-2003, 08:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •