View Issue Details

IDProjectCategoryView StatusLast Update
0014157mantisbtapi soappublic2015-07-27 16:16
Reporterchrstph Assigned Torombert  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformPHP 5.4 
Product Version1.2.10 
Target Version1.2.13Fixed in Version1.2.13 
Summary0014157: Array to string conversion error on soap request with PHP 5.4
Description

I try to complete my installation of Mylyn 3.6 with Mantis 1.2.10.
To check the error received in Eclipse, I test the webservice with SOAPUI4.0.1

I check the service "mc_projects_get_user_accessible" via the URL mantis/api/soap/mantisconnect.php.

When I send this envelope:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:man="http://futureware.biz/mantisconnect&quot;>
<soapenv:Header/>
<soapenv:Body>
<man:mc_projects_get_user_accessible soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/&quot;>
<username xsi:type="xsd:string">usr</username>
<password xsi:type="xsd:string">pwd</password>
</man:mc_projects_get_user_accessible>
</soapenv:Body>
</soapenv:Envelope

I receive this error:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/&quot;>
<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 NOTICE,
Error Description:
Array to string conversion,
Stack Trace:
nusoap.php L5763 serializeType(<string>'return', <string>'tns:ProjectDataArray', <Array> { [0] => <Array> { ['id'] => 1, ['name'] => 'mylyn-test', ['status'] => <Array> { ['id'] => '10', ['name'] => 'development' }, ['enabled'] => '1', ['view_state'] => <Array> { ['id'] => '10', ['name'] => 'public' }, ['access_min'] => <Array> { ['id'] => '10', ['name'] => 'viewer' }, ['file_path'] => '', ['description'] => '', ['subprojects'] => <Array> { } }, [1] => <Array> { ['id'] => 2, ['name'] => 'sandbox', ['status'] => <Array> { ['id'] => '10', ['name'] => 'development' }, ['enabled'] => '1', ['view_state'] => <Array> { ['id'] => '10', ['name'] => 'public' }, ['access_min'] => <Array> { ['id'] => '10', ['name'] => 'viewer' }, ['file_path'] => '', ['description'] => '', ['subprojects'] => <Array> { } } }, <string>'encoded', <boolean>false)
nusoap.php L4133 serializeRPCParameters(<string>'mc_projects_get_user_accessible', <string>'output', <Array> { [0] => <Array> { [0] => <Array> { ['id'] => 1, ['name'] => 'mylyn-test', ['status'] => <Array> { ['id'] => '10', ['name'] => 'development' }, ['enabled'] => '1', ['view_state'] => <Array> { ['id'] => '10', ['name'] => 'public' }, ['access_min'] => <Array> { ['id'] => '10', ['name'] => 'viewer' }, ['file_path'] => '', ['description'] => '', ['subprojects'] => <Array> { } }, [1] => <Array> { ['id'] => 2, ['name'] => 'sandbox', ['status'] => <Array> { ['id'] => '10', ['name'] => 'development' }, ['enabled'] => '1', ['view_state'] => <Array> { ['id'] => '10', ['name'] => 'public' }, ['access_min'] => <Array> { ['id'] => '10', ['name'] => 'viewer' }, ['file_path'] => '', ['description'] => '', ['subprojects'] => <Array> { } } } })
nusoap.php L3721 serialize_return()
mantisconnect.php L1717 service(<string>'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:man="http://futureware.biz/mantisconnect&quot;>
<soapenv:Header/>
<soapenv:Body>
<man:mc_projects_get_user_accessible soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/&quot;>
<username xsi:type="xsd:string">usr</username>
<password xsi:type="xsd:string">pwd</password>
</man:mc_projects_get_user_accessible>
</soapenv:Body>
</soapenv:Envelope>')]]></faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelop>

I'm trying to find into the mantis configuration if I missed something but in case, I report a possible bug ?

The web client and the server are running on the same host, PHP seems running with a memory limit set to 128M.

Steps To Reproduce

SOAPUI4, call mc_projects_get_user_accessible with a valid user/password.

TagsNo tags attached.

Relationships

related to 0014871 closedrombert mantisbt Add support for the built-in soap extension in addition to nusoap 
related to 0015721 closedgrangeway mantisbt Functionality to consider porting to master-2.0.x 
has duplicate 0014290 closedvboctor MantisTouch Cannot Login to Mantis Touch 
has duplicate 0015435 closedrombert mantisbt mylyn matins intergration fail 
has duplicate 0015687 closedrombert mantisbt Plugin is unable do download list of ticktes due to server error. 
has duplicate 0020545 closedrombert mantisbt Not able to connect from Jenkin and SOAP 
related to 0014744 closeddregad mantisbt Unicode characters in text field prevent bug display 
related to 0016344 closeddregad mantisbt Array to string conversion on SOAP request with PHP 5.5.3 

Activities

rombert

rombert

2012-04-17 11:59

reporter   ~0031677

I don't see anything obviously wrong in the stack trace so I'm not sure what triggered the notice. What version of PHP are you running?

chrstph

chrstph

2012-04-18 07:16

reporter   ~0031683

Windows: XP (localhost: web client, soapui and server)
Apache: 2.2
PHP: 5.4.0
SOAP UI: 4.0.1

rombert

rombert

2012-04-18 08:06

reporter   ~0031684

This might be an PHP 5.4.0 issue . Can you try with PHP 5.3.x ?

chrstph

chrstph

2012-04-19 03:31

reporter   ~0031690

Hi,

It's working with 5.3.10, didn't tried with 5.4.1RC2

Thanks for your time.

rombert

rombert

2012-04-19 05:05

reporter   ~0031691

If the problem is PHP 5.4 we should fix this in the near future, but it's not such high priority.

qingwl

qingwl

2012-05-28 04:20

reporter   ~0031910

Hi,

I got the same errors when trying on most of the methods, e.g. 'mc_enum_project_status' on PHP 5.3.2.

rombert

rombert

2012-05-28 15:02

reporter   ~0031915

(In reply to comment 0014157:0031910)

Hi,

I got the same errors when trying on most of the methods, e.g.
'mc_enum_project_status' on PHP 5.3.2.

Can you confirm that it's 5.3.2 ? I've been running the SOAP API on PHP 5.3.x for months with no issues.

vboctor

vboctor

2012-06-02 18:46

manager   ~0031984

@rombert, I've marked 0014290 as a duplicate of this one. The user had issues with 5.4 that got fixed when downgrading to an older PHP version. Any idea why we are having this issue? Thoughts about a fix?

rombert

rombert

2012-06-05 15:19

reporter   ~0032026

I'm not sure where to start ; I don't have a php 5.4 box for testing but I might get around to it next week. A good discussion of the technical issue can be found at https://github.com/symfony/symfony/issues/2585 .

rombert

rombert

2012-06-13 16:40

reporter   ~0032092

The fix for bug 0014341 should prevent system notices from halting SOAP call execution. Can you retry with 1.2.11 on PHP 5.4?

papoanaya

papoanaya

2012-06-24 18:23

reporter   ~0032165

Last edited: 2012-06-24 18:27

Hi:

I got hit with this problem when Arch Linux upgraded to PHP 2.4. Being that a downgrade was not an option, I decided to go to the bottom of it.

The problem seems to be on the debug statement when it tries to convert an array to a string around line 6139 in serializeType in nusoap.php. The debug statement is in comments in the note, because is the one causing the error problems. Most likely it should be resolved with an application of implode on the right variable type. But being that I do not need to run debug, a comment on the statement will do it for me.

Code included:

$rows = sizeof($value);
$contents = '';
foreach($value as $k => $v) {
// PROBLEM STATEMENT
//$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
// PROBLEM STATEMENT

//if (strpos($typeDef['arrayType'], ':') ) {

if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
$contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
} else {
$contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
}

...

rombert

rombert

2012-06-25 08:26

reporter   ~0032173

Great, thanks for letting us know. I think we should look into patching this ourselves before nusoap comes up with a new release.

skeyby

skeyby

2012-09-11 09:11

reporter   ~0032820

I can confirm the problem (PHP 5.4.6 under FreeBSD) and, most important, I can confirm the fix. The exact line for mantis 1.2.11 is 6132: removing the debug statement resolved all the problems.

dennis

dennis

2012-10-11 23:26

reporter   ~0033170

yes, it's php 5.4.x issue.
I have the same issue.

rombert

rombert

2012-11-01 16:20

reporter   ~0033406

Rather than take the burden of maintaining a fork of nusoap, I plan to 'fix' this by allowing you to use the php5 soap extension instead of nusoap. Would such an approach work for you?

rombert

rombert

2012-11-12 17:18

reporter   ~0034305

The next version supports using the php5 soap extension if it is present, and by definition this supports PHP 5.4.

dust

dust

2012-11-14 03:45

reporter   ~0034309

I found bug related to this problem, at mc_api.php
Any russian letters removes by regex. Simple fix:

/**

  • Removes any invalid character from the string per XML 1.0 specification
  • @param string $p_input
  • @return string the sanitized XML
    */
    function mci_sanitize_xml_string ( $p_input ) {
    • return preg_replace( '/[^\x9\xA\xD\x20-\xD7FF\xE000-\xFFFD\x{10000}-\x{10FFFF}]/u', '', $p_input);
    • return htmlspecialchars($p_input);
      }
rombert

rombert

2012-11-14 03:55

reporter   ~0034310

Thanks for reporting this error!

I don't think we can apply your fix, as nusoap/the soap extension already do this encoding and it's not effective for our problem. But I'll try to make the regex not reomve russian letters.

dregad

dregad

2012-11-15 13:34

developer   ~0034326

Last edited: 2012-11-15 13:34

Hey guys,

I took me a while to research why the regex was not working, but I think I have finally got it, thanks to [1] - it appears that PHP / PCRE does not recognize the \xNNNN syntax, you have to use the \x{NNNN} constructs all the time

Could you please try with the following regex:

[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/u

Let me know how it goes.

[1] http://stackoverflow.com/questions/2728070/how-do-i-replace-characters-not-in-range-0x5e10-0x7f35-with-in-php/2728372#2728372

rombert

rombert

2012-11-15 15:03

reporter   ~0034329

The fix works fine for my test ( Russian, Mandarin Chinese ). Thanks!

papoanaya

papoanaya

2012-11-19 18:53

reporter   ~0034351

Rombert:

Sorry for the delay, using the PHP5 soap extension rather than nusoap.php is fine with me. I did not see any objections and the issue is marked as fixed.

I'll look forward to it on the next release. :)

Thanks.

Luis

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036129

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master 7ae2d9ae

2012-11-15 15:01

rombert


Details Diff
Fix replacing of invalid XML characters

Fixes 0014157: Array to string conversion error on soap request with PHP
5.4
Affected Issues
0014157
mod - api/soap/mc_api.php Diff File

MantisBT: master-1.2.x 500a0fce

2012-11-15 15:01

rombert


Details Diff
Fix replacing of invalid XML characters

Fixes 0014157: Array to string conversion error on soap request with PHP
5.4
Affected Issues
0014157
mod - api/soap/mc_api.php Diff File