News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

File ManageAttachments.php bug

Started by digger, January 23, 2015, 09:34:41 AM

Previous topic - Next topic

digger

File ManageAttachments.php contains this code

function ManageAttachmentSettings($return_config false)
{
	
global 
$txt$modSettings$scripturl$context$options$sourcedir;

	
$context['valid_upload_dir'] = is_dir($modSettings['attachmentUploadDir']) && is_writable($modSettings['attachmentUploadDir']);


But $modSettings['attachmentUploadDir'] can contain a big serialized array if we have several attachments directories.

Therefore, the following error in the forum log
is_dir(): File name is longer than the maximum allowed path length on this platform (4096): a:84:{i:1;s:67:"/var/www/...
File: /var/www/.../Sources/ManageAttachments.php
Line: 155

margarett

How many folders to you have?

I understand that the code seems to be wrong (and I think it's not the first time I read this), it has been changed in 2.1 already, but I can't seem to reproduce your error in my test board...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

digger

Quote from: margarett on January 23, 2015, 12:29:07 PM
How many folders to you have?

I understand that the code seems to be wrong (and I think it's not the first time I read this), it has been changed in 2.1 already, but I can't seem to reproduce your error in my test board...

That forum have 85 directories for attachments.
If you want to reproduce error, you should create as many folders so the number of characters in the $modSettings['attachmentUploadDir'] exceeds 4096 (for Linux systems). Or you can save any value bigger then 4096 chars to the $modSettings['attachmentUploadDir']

Arantor

So the question is... why isn't this test aware of multi-directory support and surely that being the case it should be more broken by displaying something because $context['valid_upload_dir'] is presumably false which should be exposed on the UI side.

margarett

Not sure Arantor... Maybe because the main UI doesn't show the multiple folders, just a link to edit them?
In any case, it seems to be wrong, really...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

I can't really reproduce this, not even after I created (scripted of course :P ) 400 attachment folders...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: