View Issue Details

IDProjectCategoryView StatusLast Update
0012246mantisbtapi soappublic2013-04-29 08:16
Reporterbridog Assigned Torombert  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
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
Description

The 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.

Activities

bridog

bridog

2010-08-08 12:14

reporter   ~0026243

PHP Version is 5.2.10.

rombert

rombert

2010-08-08 12:17

reporter   ~0026244

Thanks, will take a look.

Related Changesets

MantisBT: master c5b51f0e

2010-08-18 18:06

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.
Affected Issues
0012246
mod - tests/soap/EnumTest.php Diff File
mod - api/soap/mc_enum_api.php Diff File

MantisBT: master-1.2.x 31a20df8

2010-08-18 18:06

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.
Affected Issues
0012246
mod - tests/soap/EnumTest.php Diff File
mod - api/soap/mc_enum_api.php Diff File