Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2770 Cannot properly delete folder consisting of only numbers.

open
nobody
None
5
2011-09-22
2011-09-22
Celanon
No

If a folder name consists solely of numbers (for example 249) and the IMAP delimiter is ".", one gets an error when attempting to delete said folder. Namely, an error is raised that the folder Trash.249 already exists and cannot be created. Inspection of the code shows that the logic on line 135 of src/delete_folders.php designed to identify whether or not the folder to delete has subfolders will erroneously identify a folder consisting only of numbers as having children because "249" (in this example) will == "249.".

Switching the statement from:

if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox_no_dm . $delimiter)) == ($mailbox_no_dm . $delimiter)) {

to

if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox_no_dm . $delimiter)) === ($mailbox_no_dm . $delimiter)) {

will fix the problem.

There are no problems if the IMAP delimiter is "/"or if the folder consists of a mixture of characters and numbers, presumably because PHP no longer treats 249. as having the same value as the integer 249.

Discussion

  • Celanon
    Celanon
    2011-09-22

    Apologies; forgot to include the necessary system envrionment data:

    RedHat Enterprise Linux 5.7
    Kernel 2.6.18-274 (Redhat provided)
    php-5.1.6-27.el5_5.3 (RedHat provided)
    httpd-2.2.3-53.el5 (RedHat provided)
    Squirrelmail-1.4.22 (and 1.4.21) (from website, not RedHat provided)