Mantis Bugtracker 

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008551TestLinkAPI - XMLRPCpublic2019-01-29 16:592019-11-07 12:21
Assigned To 
PlatformVMOSCent OSOS Version
Product Version1.9.17 (2018 Q1) 
Fixed in Version 
Summary0008551: Can't upload an execution attachment bigger than 400Ko
DescriptionSimilar to bug id 0005055

When uploading a large file (>400Ko) with a test case result using XML-RPC, an exception occurs :

br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error uploading attachment for execution: parse error. not well formed
Steps To ReproduceUpload a 4Mo file via XML-RPC
Additional InformationI've patch it in class-IXR.php, same problem as report in bug id 0005055.
Not sure it's the best (not even a good) way to correct it.

function parse() {
        // Goal of this is to avoid too long lines for first line
        $this->message = str_replace("><",">\n<",$this->message);
        // first remove the XML declaration
        $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message,1);

        if (trim($this->message) == '') {
            return false;
TagsNo tags attached.
Database (MySQL,Postgres,etc)mariaDB
PHP Version
QA Team - Task Workflow Status
Attached Files

- Relationships

-  Notes
Mat83 (reporter)
2019-01-29 17:01


was only for debug :)
fman (administrator)
2019-01-30 09:37

In addition to the code, some comment explaining how this has been fixed is a must.
Mat83 (reporter)
2019-01-30 13:55

searching on the net I found the bug id 0005055 with same error,
then I checked that the error occurs at same place, when trying to remove the XML declaration. So I dump the message with :
The message is only on 1 ligne, and seems to be well formed.
I conclude the preg_replace can't manage a so long line, even with the bug id 5055 correction.
So I try to change the xml message with some \n between xml tag,
and no more error occurs.

hoping this answers the request, first time I post a bug on mantis ...
fman (administrator)
2019-01-31 09:03

First or not first one reporting has no difference.
Please follow defacto standards for issue reporting
Mat83 (reporter)
2019-02-01 11:00

Some more information :
testlink installation is from bitnami docker 1.9.17 (PHP 7.1.23),
xml is generated from testlink-plugin (3.14) for jenkins (2.138.2)
jburgers (reporter)
2019-10-01 12:50

Changing this line

$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message,1);

for these two ones

$header = preg_replace('/<\?xml(.*)?\?'.'>/', '', substr($this->message, 0, 100),1);
$this->message = substr_replace($this->message, $header, 0, 100);

worked for me. I have tested with a 5MB attachment.

I have never worked before with PHP, so don't know if it is ok doing that.

(I took these guys work as reference: [^])

- Issue History
Date Modified Username Field Change
2019-01-29 16:59 Mat83 New Issue
2019-01-29 17:01 Mat83 Note Added: 0028476
2019-01-30 09:37 fman Note Added: 0028480
2019-01-30 13:55 Mat83 Note Added: 0028485
2019-01-31 09:03 fman Note Added: 0028487
2019-02-01 11:00 Mat83 Note Added: 0028491
2019-10-01 12:50 jburgers Note Added: 0029232

Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker