View Issue Details

IDProjectCategoryView StatusLast Update
0023737mantisbtattachmentspublic2018-02-04 07:03
Reportermbrillante Assigned Toatrol  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product Version2.9.0 
Summary0023737: Cannot download or view attachments
Description

I have tried both DISK and DATABASE options and in both cases the attachment is saved either in the database or on the disk. I use a windows server 2012 R2 machine.
When I click on any attached file I get redirected on http://myserver/file_download.php?file_id=26&type=bug and I get a blank page with this message (tried Chrome and IE)

This page isn’t working
uat.mydiabetesmyway.scot.nhs.uk is currently unable to handle this request.
HTTP ERROR 500

below my config_inc.php content for attachments and upload

############################
   # Bug Attachments Settings
   ############################

   # Specifies the maximum size below which an attachment is previewed in the bug
   # view pages.  To disable this feature, set max size to 0.
   # This feature applies to: bmp, png, gif, jpg
   $g_preview_attachments_inline_max_size = 0;

   # Extenstions for text files that can be expanded inline.
   $g_preview_text_extensions = array( 'txt', 'pdf', 'diff', 'patch' );

   # Extensions for images that can be expanded inline.
   $g_preview_image_extensions = array( 'bmp', 'png', 'gif', 'jpg', 'jpeg' );

   # Specifies the maximum width for the auto-preview feature.  If no maximum width should be imposed
   # then it should be set to 0.
   $g_preview_max_width = 0;

   # Specifies the maximum height for the auto-preview feature.  If no maximum height should be imposed
   # then it should be set to 0.
   $g_preview_max_height = 250;

   # --- Show an attachment indicator on bug list ---
   # Show a clickable attachment indicator on the bug
   # list page if the bug has one or more files attached.
   # Note: This option is disabled by default since it adds
   # 1 database query per bug listed and thus might slow
   # down the page display.
   $g_show_attachment_indicator = OFF;

   # access level needed to view bugs attachments.  View means to see the file names
   # sizes, and timestamps of the attachments.
   $g_view_attachments_threshold   = VIEWER;

   # list of filetypes to view inline. This is a string of extentions separated by commas
   # This is used when downloading an attachment.  Rather than downloading, the attachment
   # is viewed in the browser.
   $g_inline_file_exts = 'gif,png,jpg,jpeg';

   # access level needed to download bug attachments
   $g_download_attachments_threshold   = VIEWER;

   # allow users to view attachments uploaded by themselves even if their access
   # level is below view_attachments_threshold.
   $g_allow_view_own_attachments = ON;

   # allow users to download attachments uploaded by themselves even if their access
   # level is below download_attachments_threshold.
   $g_allow_download_own_attachments = ON;

# --- File Uploads ---
$g_file_upload_method   = DISK; # DATABASE or DISK
$g_allow_inline_attachment_rendering = ON;
$g_absolute_path_default_upload_folder = 'C:/inetpub/UploadedFiles/';
Steps To Reproduce

open an issue,
load any attachment file
click on the loaded attached file

TagsNo tags attached.

Relationships

related to 0023930 closedatrol Make Fileinfo a mandatory PHP extension 

Activities

mbrillante

mbrillante

2017-12-16 17:57

reporter   ~0058399

I found the solution; I had opcache enabled in PHP; as soon as I disabled then the attachment feature worked correctly

mbrillante

mbrillante

2017-12-16 17:58

reporter   ~0058400

my opcache settings were these below

[opcache]
zend_extension==C:\PHP\7.1.3\ext\php_opcache.dll
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

mbrillante

mbrillante

2017-12-16 17:58

reporter   ~0058401

I think that I had that enabled for word press

atrol

atrol

2017-12-17 05:00

developer   ~0058402

Thanks for telling the solution.

mbrillante

mbrillante

2017-12-17 06:30

reporter   ~0058406

no problem; it would be nice to know if I can use opcache but with different settings

atrol

atrol

2017-12-17 08:48

developer   ~0058408

Last edited: 2017-12-17 16:34

I assume this is a bug in Opcache.
Using latest 7.1.x version (7.1.12 at the moment) might fix the issue as some Opcache bugs have been fixed since 7.1.3.

mbrillante

mbrillante

2017-12-17 12:16

reporter   ~0058409

OK I'll try, I am using PHP 7.1.5. I will download the latest and re-enable opcache and etst it. I will keep you posted

sbordoni

sbordoni

2017-12-20 04:01

reporter   ~0058419

I updated my working v2.8.0 to v2.9.0, and now I have the very same problem.

As far I can see, I don't have opcache enabled.

atrol

atrol

2017-12-20 04:33

developer   ~0058420

I have the very same problem.

Does it mean you get the same error message ?

<yourURL> is currently unable to handle this request HTTP ERROR 500

If not, open a new issue for it.
Before that, check if you get any errors or warnings when running <YourMantisUrl>/admin/check/index.php and fix them.

sbordoni

sbordoni

2017-12-20 05:16

reporter   ~0058421

The very same problem.

Using Firefox i have a blank screen.
Using Edge I have error HTTP ERROR 500.

I also updated to latest PHP 7.1.12, but nothing changes.

my previosly working MBT cfg params are:

# 5.19 File Uploads
$g_allow_file_upload = ON;
$g_file_upload_method = DISK;
$g_absolute_path_default_upload_folder = 'e:/web/uploads/mantisbt/'; # used with DISK, must contain trailing \ or /.
$g_max_file_size = 2097152; # in bytes
$g_allowed_files = 'zip,7z,jpg,png'; # extensions comma separated, e.g. 'php,html,java,exe,pl'

atrol

atrol

2017-12-20 05:26

developer   ~0058422

Did you

check if you get any errors or warnings when running <YourMantisUrl>/admin/check/index.php and fix them.

sbordoni

sbordoni

2017-12-20 05:37

reporter   ~0058423

I ran it and it reported that I miss '\' at the end of $g_absolute_path_default_upload_folder.

I changed all present '/' to '\', and now it seems working fine.

Thank you

sbordoni

sbordoni

2017-12-20 05:41

reporter   ~0058424

wait... I verified a v2.8.0 link...

same bug on v2.9.0 still has the problem

sbordoni

sbordoni

2017-12-20 06:27

reporter   ~0058425

digging around, I enabled 'php_fileinfo.dll' extension into my php.ini, and it seems to solve the problem.

I wonder what is changing about between the 2 versions.

atrol

atrol

2017-12-20 06:32

developer   ~0058426

digging around, I enabled 'php_fileinfo.dll'

Seems you did not follow my instructions

Before that, check if you get any errors or warnings when running <YourMantisUrl>/admin/check/index.php and fix them.

It would have told you the reason for the problem.

So your issue is the same like 0023707

I wonder what is changing about between the 2 versions.

https://github.com/mantisbt/mantisbt/commit/5f6292fbabea4de238cb10cb28e3449f71fa8679

sbordoni

sbordoni

2017-12-20 08:15

reporter   ~0058428

[../check/index.php]

I compared the report of the two versions, and I have the same warnings (excluding some security items to verify).

In both versions, I had the following:

Attachments
Fileinfo extension is available for determining file MIME types
Web clients may struggle to download files without knowing the MIME type of each attachment.

This put me in the right direction.

sbordoni

sbordoni

2017-12-21 03:55

reporter   ~0058432

... later I have discovered, that using this extension (under Windows) is causing failure on uploading files.

Now I rolled back to v2.8.1 that is working fine.