MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012246mantisbtapi soappublic2010-08-08 12:122013-04-29 08:16
Reporterbridog 
Assigned Torombert 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformIntel x64OSUbuntu DesktopOS Version10.04
Product Version1.2.2 
Target Version1.2.3Fixed in Version1.2.3 
Summary0012246: API call to mc_enum_get produces soap fault
DescriptionThe following soap call to mc_enum_get() ...

<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"> [^]
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_enum_get soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> [^]
         <username xsi:type="xsd:string">johndoe</username>
         <password xsi:type="xsd:string">johndoe</password>
         <enumeration xsi:type="xsd:string">severity</enumeration>
      </man:mc_enum_get>
   </soapenv:Body>
</soapenv:Envelope>

... produces this result:

<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">Error Type: SYSTEM NOTICE,
Error Description:
Undefined variable: t_user_id,
Stack Trace:
mc_api.php L0 mc_error_handler()
nusoap.php L0 mc_enum_get()
nusoap.php L4087 call_user_func_array()
nusoap.php L3718 invoke_method()
mantisconnect.php L1451 service()
mantisconnect.php L0 {main}()</faultstring>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The underlying function looks like this:

function mc_enum_get( $p_username, $p_password, $p_enumeration ) {
        if ( ! mci_validate_enum_access($p_username, $p_password)) {
                return new soap_fault( 'Client', '', 'Access Denied' );
        }
        $t_lang = mci_get_user_lang( $t_user_id );
        return lang_get( $p_enumeration . '_enum_string', $t_lang );
}

$t_user_id is set in the called function mci_validate_enum_access(). Username and password are correct and so the function also creates a correct user id which is stored in the variable $t_user_id. The problem is that the variable is also used in the global context of mc_enum_get, in which it is not declared.

As a quickfix I tried the following:

function mc_enum_get( $p_username, $p_password, $p_enumeration ) {
        $t_user_id = 0; // Added declaration
        if ( ! mci_validate_enum_access($p_username, $p_password)) {
                return new soap_fault( 'Client', '', 'Access Denied' );
        }
        $t_lang = mci_get_user_lang( $t_user_id );
        return lang_get( $p_enumeration . '_enum_string', $t_lang );
}

function mci_validate_enum_access($p_username, $p_password) {
        global $t_user_id; // Make the global variable available in local context
        $t_user_id = mci_check_login( $p_username, $p_password );
        if( $t_user_id === false ) {
                return false;
        }
        if( !mci_has_readonly_access( $t_user_id ) ) {
                return false;
        }

        return true;
}

Unfortunately without any luck.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
User avatar (0026243)
bridog (reporter)
2010-08-08 12:14

PHP Version is 5.2.10.
User avatar (0026244)
rombert (developer)
2010-08-08 12:17

Thanks, will take a look.

- Related Changesets
MantisBT: master c5b51f0e
Timestamp: 2010-08-18 22:06:46
Author: rombert
Details ] Diff ]
Fix 0012246: SOAP API call mc_enum_get was not working

The mc_enum_get method was referencing an undefined parameter
which caused a SYSTEM WARNING on installations where such
warnings are reported.
mod - tests/soap/EnumTest.php Diff ] File ]
mod - api/soap/mc_enum_api.php Diff ] File ]
MantisBT: master-1.2.x 31a20df8
Timestamp: 2010-08-18 22:06:46
Author: rombert
Details ] Diff ]
Fix 0012246: SOAP API call mc_enum_get was not working

The mc_enum_get method was referencing an undefined parameter
which caused a SYSTEM WARNING on installations where such
warnings are reported.
mod - tests/soap/EnumTest.php Diff ] File ]
mod - api/soap/mc_enum_api.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-08-08 12:12 bridog New Issue
2010-08-08 12:14 bridog Note Added: 0026243
2010-08-08 12:17 rombert Note Added: 0026244
2010-08-08 12:17 rombert Assigned To => rombert
2010-08-08 12:17 rombert Status new => assigned
2010-08-08 12:17 rombert Target Version => 1.2.3
2010-08-18 18:11 rombert Changeset attached => MantisBT master c5b51f0e
2010-08-18 18:11 rombert Changeset attached => MantisBT master-1.2.x 31a20df8
2010-08-18 18:11 rombert Resolution open => fixed
2010-08-18 18:11 rombert Fixed in Version => 1.2.3
2010-08-18 18:12 rombert Status assigned => resolved
2010-09-17 21:35 dhx Changeset attached => MantisBT master-1.2.x ea7af5eb
2010-12-17 04:37 rombert Status resolved => closed
2013-04-29 08:16 dregad Changeset removed MantisBT master-1.2.x ea7af5eb =>


MantisBT 1.2.16dev master-1.2.x-05091f5 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.0854 seconds.
memory usage: 2,826 KB
Powered by Mantis Bugtracker