orangescrum icon indicating copy to clipboard operation
orangescrum copied to clipboard

Bug : Infinite while loop error log causes disk to be full

Open sergeByishimo opened this issue 2 years ago • 0 comments

Hi!

Below codes in question found in app/Config/setup.php line 100,101,102

$check_file = fopen($check_constants_filename, "a+");
while (!feof($check_file)) {
    $check_line = fgets($check_file);

If fopen() above the while condition returned a false boolean instead of the expected resource stream parameter, it logs this error

PHP Warning: feof() expects parameter 1 to be resource, boolean given in ../app/Config/setup.php on line 101, referer: http://localhost/dashboard

Which because the feof() function is in a while loop condition, it causes an infinite loop that leads to the disk becoming full because of that error being logged in an infinite loop.

IMO fopen() might return false because the file permissions are not configured right, but that doesnt mean orangescrum should fill the whole disk with that error.

I saw this kind of structure in multiple places in the codes. It would be fixed by an if condition before the while loop, checking if fopen() did not return a false boolean.

Let me know if a pull request is welcome, I will be glad to contribute.

Best regards,

sergeByishimo avatar Nov 09 '22 09:11 sergeByishimo