View Issue Details

IDProjectCategoryView StatusLast Update
0012837mantisbtdb postgresqlpublic2016-07-19 10:29
ReporterdforceAssigned Todregad 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformMicrosoftOSWindowsOS Version2008 R2
Product Version1.2.4 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0012837: Download Attachment doesn't work; Get some header information or Jabber

uploading a file works fine so far, but if i try to download an attachment, i sometimes only get a text-file with a lots of jabber like:

ans sometimes the file is opened in the browser and i see something like:

HTTP/1.1 200 OK
Cache-Control: private, max-age=10800, pre-check=10800
Pragma: no-cache
Content-Length: 6704
Content-Type: text/plain; charset=iso-8859-1
Expires: Fri, 04 Mar 2011 14:34:46 GMT
Last-Modified: Fri, 04 Mar 2011 14:13:07 GMT
Server: Microsoft-IIS/7.5
X-Powered-By: PHP/5.3.5
X-Frame-Options: DENY
X-Content-Security-Policy: allow 'self'; options inline-script eval-script; frame-ancestors 'none'
X-Content-Type-Options: nosniff
Content-Disposition: attachment; filename*=UTF-8''reg_file.reg; filename="reg_file.reg"
X-Powered-By: ASP.NET
Date: Fri, 04 Mar 2011 14:34:45 GMT


Steps To Reproduce
  • upload a reg-file
  • try to download it
Additional Information
  • mantis 1.2.4
  • windows 2008 r2 with IIS7
  • php-5.3.5-nts-Win32-VC9-x86
  • postgres 9 / UTF8

open_basedir = "C:\inetpub\wwwroot;C:\inetpub\temp;C:\inetpub\upload;"
with read/write access for IUSR

  • the project itself has no upload directory defined.
  • save uploads to DATABASE
Tagsattachment, documentation-needed, download, iis, postgresql, utf8, windows


has duplicate 0013405 closedatrol File attachments are corrupted on PostgreSQL 
has duplicate 0017151 closeddregad Attachment corrupted on PostgreSQL 
related to 0021380 new Cannot store file attachments in postgresql 
child of 0013713 closeddregad Upgrade ADOdb library to latest version 




2011-03-17 20:49

reporter   ~0028434

Last edited: 2011-03-17 20:50

View 2 revisions

Postgres 9.0 changed default encoding for bytea.

Current PHP pgsql function pg_unescape_bytea does not support this new encoding.

The workaround is to configure a property in the postgres database for the mantisbt user, to make postgres behave as the old default.

ALTER USER mantisbt SET bytea_output = 'escape';

(or using the pgadmin interface)

All the files already uploaded can be downloaded ok after this change.

I had this problem, and solved it yesterday. I tested and reproduced it in RHEL 5.5 and opensuse 11.3 and 11.4.

The problem also affect mantis 1.2.3 (and probably older versions)



2011-03-18 08:13

reporter   ~0028441

Thanks a lot for this hint!

After I executed the query and added C:\PHP\magic\ to the open base dir path in the php.ini it works!



2011-03-25 06:08

reporter   ~0028476

also possible and maybe more useful:

ALTER DATABASE mantisbt SET bytea_output = 'escape';



2012-08-08 05:41

developer   ~0032501

I confirm that dforce's workaround (0012837:0028476) is a good solution to this issue.

The problem with the incorrect decoding of BLOB (bytea) columns lies in the underlying ADOdb library ADORecordSet_postgres64::_decode() function. This has been fixed in ADOdb version 5.14 (MantisBT 1.2.x currently ships with 5.10).

Issue History

Date Modified Username Field Change
2011-03-04 09:39 dforce New Issue
2011-03-17 20:49 muralito Note Added: 0028434
2011-03-17 20:50 muralito Note Edited: 0028434 View Revisions
2011-03-18 08:13 dforce Note Added: 0028441
2011-03-18 08:15 dforce Tag Attached: attachment
2011-03-18 08:15 dforce Tag Attached: postgresql
2011-03-18 08:15 dforce Tag Attached: utf8
2011-03-18 08:15 dforce Tag Attached: download
2011-03-18 08:15 dforce Tag Attached: iis
2011-03-18 08:15 dforce Tag Attached: postgres
2011-03-18 08:15 dforce Tag Attached: windows
2011-03-18 09:53 atrol Category other => db postgresql
2011-03-25 06:08 dforce Note Added: 0028476
2011-10-13 04:57 atrol Relationship added has duplicate 0013405
2012-08-08 05:41 dregad Note Added: 0032501
2012-08-08 05:41 dregad Status new => confirmed
2012-08-08 05:42 dregad Relationship added child of 0013713
2013-04-13 15:33 rombert Tag Attached: documentation-needed
2013-10-17 12:29 dregad Status confirmed => resolved
2013-10-17 12:29 dregad Fixed in Version => 1.3.0-beta.1
2013-10-17 12:29 dregad Resolution open => fixed
2013-10-17 12:29 dregad Assigned To => dregad
2013-10-17 12:58 dregad Target Version => 1.3.0-beta.1
2013-11-03 05:43 dregad Tag Detached: postgres
2014-04-02 11:52 dregad Relationship added has duplicate 0017151
2014-12-08 00:34 vboctor Status resolved => closed
2016-07-19 10:29 atrol Relationship added related to 0021380