Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17301

Wrong length parameter for fread in phpbb/cache/driver/file.php can lead to unusable forum

XMLWordPrintable

      Yesterday our forum stopped working out of the blue with an 500 internal server error. The investigation lead to the following stack trace in the error logs:

      [Sat Apr 06 09:59:36.760225 2024] [php:error] [pid 6737] [client 127.0.0.1:52018] PHP Fatal error:  Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /home/project-web/zeoslib/htdocs/phpbb/cache/driver/file.php:397
      Stack trace:
      #0 /home/project-web/zeoslib/htdocs/phpbb/cache/driver/file.php(397): fread(Resource id #4, -1)
      #1 /home/project-web/zeoslib/htdocs/phpbb/cache/driver/file.php(51): phpbb\\cache\\driver\\file->_read('data_global')
      #2 /home/project-web/zeoslib/htdocs/phpbb/cache/driver/file.php(295): phpbb\\cache\\driver\\file->load()
      #3 /home/project-web/zeoslib/htdocs/phpbb/cache/driver/file.php(171): phpbb\\cache\\driver\\file->_exists('class_loader___...')
      #4 /home/project-web/zeoslib/htdocs/phpbb/class_loader.php(76): phpbb\\cache\\driver\\file->get('class_loader___...')
      #5 /home/project-web/zeoslib/htdocs/common.php(147): phpbb\\class_loader->set_cache(Object(phpbb\\cache\\driver\\file))
      #6 /home/project-web/zeoslib/htdocs/viewforum.php(20): include('/home/project-w...')
      #7 {main}
      

      I solved the problems by purging the cache as described in https://www.phpbb.com/support/docs/en/3.3/kb/article/purging-the-phpbb-cache/.

      Maybe it is a valild idea to check the length argument before using it and if it is too small, work as if the file doesn't exist?

            Marc Marc
            marsupilami79 marsupilami79
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: