View Issue Details

IDProjectCategoryView StatusLast Update
0011992mantisbtapi soappublic2010-12-17 04:37
ReporterAboeBakr Assigned Torombert  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionunable to reproduce 
Product Version1.2.1 
Summary0011992: g_cache_versions is null throwing error when adding issue
Description

when adding an issue using soap, supplying a version triggers an error.
$g_cache_versions is null somehow, which causes the foreach in version_get_id to fail.

temporary fix is checking if $g_cache_versions is null and creating empty array if so.

Steps To Reproduce

add issue via soap
make sure version is set

Additional Information

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">Server</faultcode>
<faultactor xsi:type="xsd:string"/>
<faultstring xsi:type="xsd:string"><![CDATA[Error Type: SYSTEM WARNING,
Error Description:
Invalid argument supplied for foreach(),
Stack Trace:
mc_issue_api.php L519 version_get_id(<string>'SOMETHING', <integer>1)
UnknownFile L? mc_issue_add

TagsNo tags attached.
Attached Files
soap_input.xml (6,763 bytes)   
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_issue_add soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">USERNAME</username>
         <password xsi:type="xsd:string">PASSWORD</password>
         <issue xsi:type="man:IssueData">
            <!--You may enter the following 30 items in any order-->
            <!--Optional:-->
            <id xsi:type="xsd:integer">?</id>
            <!--Optional:-->
            <view_state xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer">10</id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </view_state>
            <!--Optional:-->
            <last_updated xsi:type="xsd:dateTime"></last_updated>
            <!--Optional:-->
            <project xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer">11</id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </project>
            <!--Optional:-->
            <category xsi:type="xsd:string">VALIDCAT</category>
            <!--Optional:-->
            <priority xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </priority>
            <!--Optional:-->
            <severity xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </severity>
            <!--Optional:-->
            <status xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </status>
            <!--Optional:-->
            <reporter xsi:type="man:AccountData">
               <!--You may enter the following 4 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string">USERNAME</name>
               <!--Optional:-->
               <real_name xsi:type="xsd:string"></real_name>
               <!--Optional:-->
               <email xsi:type="xsd:string"></email>
            </reporter>
            <!--Optional:-->
            <summary xsi:type="xsd:string">soap test</summary>
            <!--Optional:-->
            <version xsi:type="xsd:string">VALIDVERSIONNAME</version>
            <!--Optional:-->
            <build xsi:type="xsd:string"></build>
            <!--Optional:-->
            <platform xsi:type="xsd:string"></platform>
            <!--Optional:-->
            <os xsi:type="xsd:string"></os>
            <!--Optional:-->
            <os_build xsi:type="xsd:string"></os_build>
            <!--Optional:-->
            <reproducibility xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </reproducibility>
            <!--Optional:-->
            <date_submitted xsi:type="xsd:dateTime"></date_submitted>
            <!--Optional:-->
            <sponsorship_total xsi:type="xsd:integer"></sponsorship_total>
            <!--Optional:-->
            <handler xsi:type="man:AccountData">
               <!--You may enter the following 4 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
               <!--Optional:-->
               <real_name xsi:type="xsd:string"></real_name>
               <!--Optional:-->
               <email xsi:type="xsd:string"></email>
            </handler>
            <!--Optional:-->
            <projection xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </projection>
            <!--Optional:-->
            <eta xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </eta>
            <!--Optional:-->
            <resolution xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </resolution>
            <!--Optional:-->
            <fixed_in_version xsi:type="xsd:string"></fixed_in_version>
            <!--Optional:-->
            <description xsi:type="xsd:string">test adding issue via soap</description>
            <!--Optional:-->
            <steps_to_reproduce xsi:type="xsd:string"></steps_to_reproduce>
            <!--Optional:-->
            <additional_information xsi:type="xsd:string"></additional_information>
            <!--Optional:-->
            <attachments xsi:type="man:AttachmentDataArray" soapenc:arrayType="man:AttachmentData[]"/>
            <!--Optional:-->
            <relationships xsi:type="man:RelationshipDataArray" soapenc:arrayType="man:RelationshipData[]"/>
            <!--Optional:-->
            <notes xsi:type="man:IssueNoteDataArray" soapenc:arrayType="man:IssueNoteData[]"/>
            <!--Optional:-->
            <custom_fields xsi:type="man:CustomFieldValueForIssueDataArray" soapenc:arrayType="man:CustomFieldValueForIssueData[]"/>
         </issue>
      </man:mc_issue_add>
   </soapenv:Body>
</soapenv:Envelope>
soap_input.xml (6,763 bytes)   
soap_output.xml (10,331 bytes)   
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode xsi:type="xsd:string">Server</faultcode>
         <faultactor xsi:type="xsd:string"/>
         <faultstring xsi:type="xsd:string"><![CDATA[Error Type: SYSTEM WARNING,
Error Description:
Invalid argument supplied for foreach(),
Stack Trace:
mc_issue_api.php L528 version_get_id(<string>'VALIDVERSIONNAME', <integer>11)
UnknownFile L? mc_issue_add(<string>'', <string>'PASSWORD', <Array> { ['id'] => 0, ['view_state'] => <Array> { ['id'] => 10, ['name'] => '' }, ['last_updated'] => '', ['project'] => <Array> { ['id'] => 11, ['name'] => '' }, ['category'] => 'Taxonomy', ['priority'] => <Array> { ['id'] => 0, ['name'] => '' }, ['severity'] => <Array> { ['id'] => 0, ['name'] => '' }, ['status'] => <Array> { ['id'] => 0, ['name'] => '' }, ['reporter'] => <Array> { ['id'] => 0, ['name'] => 'USERNAME', ['real_name'] => '', ['email'] => '' }, ['summary'] => 'soap test', ['version'] => 'VALIDVERSIONNAME', ['build'] => '', ['platform'] => '', ['os'] => '', ['os_build'] => '', ['reproducibility'] => <Array> { ['id'] => 0, ['name'] => '' }, ['date_submitted'] => '', ['sponsorship_total'] => 0, ['handler'] => <Array> { ['id'] => 0, ['name'] => '', ['real_name'] => '', ['email'] => '' }, ['projection'] => <Array> { ['id'] => 0, ['name'] => '' }, ['eta'] => <Array> { ['id'] => 0, ['name'] => '' }, ['resolution'] => <Array> { ['id'] => 0, ['name'] => '' }, ['fixed_in_version'] => '', ['description'] => 'test adding issue via soap', ['steps_to_reproduce'] => '', ['additional_information'] => '', ['attachments'] => <Array> {  }, ['relationships'] => <Array> {  }, ['notes'] => <Array> {  }, ['custom_fields'] => <Array> {  } })
nusoap.php L4002 call_user_func_array(<string>'mc_issue_add', <Array> { [0] => 'USERNAME', [1] => 'PASSWORD', [2] => <Array> { ['id'] => 0, ['view_state'] => <Array> { ['id'] => 10, ['name'] => '' }, ['last_updated'] => '', ['project'] => <Array> { ['id'] => 11, ['name'] => '' }, ['category'] => 'Taxonomy', ['priority'] => <Array> { ['id'] => 0, ['name'] => '' }, ['severity'] => <Array> { ['id'] => 0, ['name'] => '' }, ['status'] => <Array> { ['id'] => 0, ['name'] => '' }, ['reporter'] => <Array> { ['id'] => 0, ['name'] => 'USERNAME', ['real_name'] => '', ['email'] => '' }, ['summary'] => 'soap test', ['version'] => 'VALIDVERSIONNAME', ['build'] => '', ['platform'] => '', ['os'] => '', ['os_build'] => '', ['reproducibility'] => <Array> { ['id'] => 0, ['name'] => '' }, ['date_submitted'] => '', ['sponsorship_total'] => 0, ['handler'] => <Array> { ['id'] => 0, ['name'] => '', ['real_name'] => '', ['email'] => '' }, ['projection'] => <Array> { ['id'] => 0, ['name'] => '' }, ['eta'] => <Array> { ['id'] => 0, ['name'] => '' }, ['resolution'] => <Array> { ['id'] => 0, ['name'] => '' }, ['fixed_in_version'] => '', ['description'] => 'test adding issue via soap', ['steps_to_reproduce'] => '', ['additional_information'] => '', ['attachments'] => <Array> {  }, ['relationships'] => <Array> {  }, ['notes'] => <Array> {  }, ['custom_fields'] => <Array> {  } } })
nusoap.php L3691 invoke_method()
mantisconnect.php L1393 service(<string>'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_issue_add soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">USERNAME</username>
         <password xsi:type="xsd:string">PASSWORD</password>
         <issue xsi:type="man:IssueData">
            <!--You may enter the following 30 items in any order-->
            <!--Optional:-->
            <id xsi:type="xsd:integer">?</id>
            <!--Optional:-->
            <view_state xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer">10</id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </view_state>
            <!--Optional:-->
            <last_updated xsi:type="xsd:dateTime"></last_updated>
            <!--Optional:-->
            <project xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer">11</id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </project>
            <!--Optional:-->
            <category xsi:type="xsd:string">VALIDCAT</category>
            <!--Optional:-->
            <priority xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </priority>
            <!--Optional:-->
            <severity xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </severity>
            <!--Optional:-->
            <status xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </status>
            <!--Optional:-->
            <reporter xsi:type="man:AccountData">
               <!--You may enter the following 4 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string">USERNAME</name>
               <!--Optional:-->
               <real_name xsi:type="xsd:string"></real_name>
               <!--Optional:-->
               <email xsi:type="xsd:string"></email>
            </reporter>
            <!--Optional:-->
            <summary xsi:type="xsd:string">soap test</summary>
            <!--Optional:-->
            <version xsi:type="xsd:string">VALIDVERSIONNAME</version>
            <!--Optional:-->
            <build xsi:type="xsd:string"></build>
            <!--Optional:-->
            <platform xsi:type="xsd:string"></platform>
            <!--Optional:-->
            <os xsi:type="xsd:string"></os>
            <!--Optional:-->
            <os_build xsi:type="xsd:string"></os_build>
            <!--Optional:-->
            <reproducibility xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </reproducibility>
            <!--Optional:-->
            <date_submitted xsi:type="xsd:dateTime"></date_submitted>
            <!--Optional:-->
            <sponsorship_total xsi:type="xsd:integer"></sponsorship_total>
            <!--Optional:-->
            <handler xsi:type="man:AccountData">
               <!--You may enter the following 4 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
               <!--Optional:-->
               <real_name xsi:type="xsd:string"></real_name>
               <!--Optional:-->
               <email xsi:type="xsd:string"></email>
            </handler>
            <!--Optional:-->
            <projection xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </projection>
            <!--Optional:-->
            <eta xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </eta>
            <!--Optional:-->
            <resolution xsi:type="man:ObjectRef">
               <!--You may enter the following 2 items in any order-->
               <!--Optional:-->
               <id xsi:type="xsd:integer"></id>
               <!--Optional:-->
               <name xsi:type="xsd:string"></name>
            </resolution>
            <!--Optional:-->
            <fixed_in_version xsi:type="xsd:string"></fixed_in_version>
            <!--Optional:-->
            <description xsi:type="xsd:string">test adding issue via soap</description>
            <!--Optional:-->
            <steps_to_reproduce xsi:type="xsd:string"></steps_to_reproduce>
            <!--Optional:-->
            <additional_information xsi:type="xsd:string"></additional_information>
            <!--Optional:-->
            <attachments xsi:type="man:AttachmentDataArray" soapenc:arrayType="man:AttachmentData[]"/>
            <!--Optional:-->
            <relationships xsi:type="man:RelationshipDataArray" soapenc:arrayType="man:RelationshipData[]"/>
            <!--Optional:-->
            <notes xsi:type="man:IssueNoteDataArray" soapenc:arrayType="man:IssueNoteData[]"/>
            <!--Optional:-->
            <custom_fields xsi:type="man:CustomFieldValueForIssueDataArray" soapenc:arrayType="man:CustomFieldValueForIssueData[]"/>
         </issue>
      </man:mc_issue_add>
   </soapenv:Body>
</soapenv:Envelope>')]]></faultstring>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
soap_output.xml (10,331 bytes)   

Activities

jreese

jreese

2010-06-04 09:25

reporter   ~0025703

Can you look into this Robert? If it's a problem with the core API's, feel free to toss it back my way. Thanks.

rombert

rombert

2010-08-18 17:55

reporter   ~0026364

Sorry for missing this.

@AboeBakr - can you please provide the XML message you're sending to the SOAP API and any customisations/patches applied?

Thanks.

AboeBakr

AboeBakr

2010-08-19 04:10

reporter   ~0026372

I attached the soap input/output used for testing.
If unable to reproduce on standard install, i'll look into the used plugins as well, we have 1 custom plugin for sure, but company plugin so have to check if/how to upload.
Thanks

as said, currently fixed by adding null check at start of mc_issue_add on $g_cache_versions

if (is_null($g_cache_versions)) {
$g_cache_versions = array();
}

rombert

rombert

2010-08-19 19:07

reporter   ~0026380

I've just committed a couple of unit tests verifying the behaviour of the mc_issue_add call, you should see them attached to the issue. Also, I notice that $g_cache_versions is initialized in version_api.php at line 91, when the file is loaded, so that can't be null.

Please reopen the issue with more information if you can provide it.

Related Changesets

MantisBT: master 78c2e76c

2010-08-19 18:58

rombert


Details Diff
Add tests for creating issues with version set

Tests for both proper version and faulty version have been added,
to verify the issues reported in bug 0011992.
Affected Issues
0011992
mod - tests/soap/IssueAddTest.php Diff File

MantisBT: master-1.2.x 4de23659

2010-08-19 18:58

rombert


Details Diff
Add tests for creating issues with version set

Tests for both proper version and faulty version have been added,
to verify the issues reported in bug 0011992.
Affected Issues
0011992
mod - tests/soap/IssueAddTest.php Diff File