Menu

#11 Missing files and dirs because of readdir comparison

Next Release
closed
nobody
None
5
2019-02-11
2008-01-16
No

At several places the application uses a WHILE loop to retrieve teh content of a directory with READDIR. However, the comparison used in the condition of the WHILE loop is incorrect, missing some files and dirs.

For example, in the original code:

while ($file = readdir($handle)){

the correct way to test for the end of the dir listing is:

while (false !== ($file = readdir($handle))){

In the current state, if a directory has a directory or file named "0" (zero), it the loop would be finished earlier.

In the current version (0.9.3), there are only 6 places to fix this.

Attached is the unified diff patch for reference.

Regards,

Mario A. Valdez-Ramirez.

Discussion

  • Mario A. Valdez-Ramirez

    Patch fix in unified diff format.

     
  • Fabrício Seger Kolling

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     At several places the application uses a WHILE loop to retrieve teh content of a directory with READDIR. However, the comparison used in the condition of the WHILE loop is incorrect, missing some files and dirs.
    
     For example, in the original code:
    
    • status: open --> accepted
    • Group: --> v1.0
     
  • Fabrício Seger Kolling

    • status: accepted --> closed
     
  • Fabrício Seger Kolling

    This was fixed on the latest release.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.