View Issue Details

IDProjectCategoryView StatusLast Update
0014157mantisbtapi soappublic2015-07-27 16:16
Reporterchrstph 
Assigned Torombert 
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformPHP 5.4OSOS Version
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 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_projects_get_user_accessible soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/>
<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/ 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 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 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_projects_get_user_accessible soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/>
<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>

Im 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

developer   ~0031677

I dont see anything obviously wrong in the stack trace so Im 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

developer   ~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,

Its working with 5.3.10, didnt tried with 5.4.1RC2

Thanks for your time.

rombert

rombert

2012-04-19 05:05

developer   ~0031691

If the problem is PHP 5.4 we should fix this in the near future, but its 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

developer   ~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 its 5.3.2 ? Ive 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, Ive 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

developer   ~0032026

Im not sure where to start ; I dont 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

developer   ~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

View 2 revisions

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

developer   ~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, its php 5.4.x issue.
I have the same issue.

rombert

rombert

2012-11-01 16:20

developer   ~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

developer   ~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

developer   ~0034310

Thanks for reporting this error!

I dont think we can apply your fix, as nusoap/the soap extension already do this encoding and its not effective for our problem. But Ill 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

View 2 revisions

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

developer   ~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.

Ill 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 20:01:22

rombert

Details Diff
Fix replacing of invalid XML characters

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

MantisBT: master-1.2.x 500a0fce

2012-11-15 20:01:22

rombert

Details Diff
Fix replacing of invalid XML characters

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

Issue History

Date Modified Username Field Change
2012-04-16 08:07 chrstph New Issue
2012-04-17 11:59 rombert Note Added: 0031677
2012-04-17 11:59 rombert Status new => feedback
2012-04-17 11:59 rombert Description Updated View Revisions
2012-04-18 07:16 chrstph Note Added: 0031683
2012-04-18 07:16 chrstph Status feedback => new
2012-04-18 08:06 rombert Note Added: 0031684
2012-04-18 08:06 rombert Status new => feedback
2012-04-18 08:06 rombert Platform => PHP 5.4
2012-04-19 03:31 chrstph Note Added: 0031690
2012-04-19 03:31 chrstph Status feedback => new
2012-04-19 05:05 rombert Note Added: 0031691
2012-04-19 05:05 rombert Priority normal => low
2012-04-19 05:05 rombert Severity block => minor
2012-04-19 05:05 rombert Status new => acknowledged
2012-04-19 05:05 rombert Target Version => 1.2.11
2012-04-19 05:05 rombert Summary Array to string conversion error on soap request => Array to string conversion error on soap request with PHP 5.4
2012-05-28 04:20 qingwl Note Added: 0031910
2012-05-28 15:02 rombert Note Added: 0031915
2012-06-02 18:44 vboctor Relationship added has duplicate 0014290
2012-06-02 18:46 vboctor Note Added: 0031984
2012-06-05 15:19 rombert Note Added: 0032026
2012-06-06 23:54 jreese Target Version 1.2.11 => 1.2.12
2012-06-13 16:40 rombert Note Added: 0032092
2012-06-13 16:40 rombert Status acknowledged => feedback
2012-06-24 18:23 papoanaya Note Added: 0032165
2012-06-24 18:27 papoanaya Note Edited: 0032165 View Revisions
2012-06-25 08:26 rombert Note Added: 0032173
2012-09-11 09:11 skeyby Note Added: 0032820
2012-10-11 23:26 dennis Note Added: 0033170
2012-11-01 16:20 rombert Note Added: 0033406
2012-11-10 19:04 dregad Target Version 1.2.12 => 1.2.13
2012-11-12 17:18 rombert Relationship added related to 0014871
2012-11-12 17:18 rombert Note Added: 0034305
2012-11-12 17:18 rombert Assigned To => rombert
2012-11-12 17:18 rombert Status feedback => resolved
2012-11-12 17:18 rombert Resolution open => fixed
2012-11-12 17:18 rombert Fixed in Version => 1.2.13
2012-11-14 03:45 dust Note Added: 0034309
2012-11-14 03:55 rombert Note Added: 0034310
2012-11-14 03:55 rombert Status resolved => assigned
2012-11-14 03:55 rombert Resolution fixed => reopened
2012-11-15 13:34 dregad Note Added: 0034326
2012-11-15 13:34 dregad Note Edited: 0034326 View Revisions
2012-11-15 13:37 dregad Relationship added related to 0014744
2012-11-15 15:03 rombert Changeset attached => MantisBT master 7ae2d9ae
2012-11-15 15:03 rombert Status assigned => resolved
2012-11-15 15:03 rombert Changeset attached => MantisBT master-1.2.x 500a0fce
2012-11-15 15:03 rombert Note Added: 0034329
2012-11-19 18:53 papoanaya Note Added: 0034351
2013-01-22 09:46 dregad Resolution reopened => fixed
2013-01-22 09:46 dregad Description Updated View Revisions
2013-01-22 09:47 dregad Status resolved => closed
2013-01-28 11:33 rombert Relationship added has duplicate 0015435
2013-03-27 09:03 rombert Relationship added has duplicate 0015687
2013-04-05 17:56 grangeway Status closed => acknowledged
2013-04-05 17:56 grangeway Note Added: 0036129
2013-04-05 19:33 grangeway Relationship added related to 0015721
2013-04-06 03:39 dregad Status acknowledged => resolved
2013-04-06 07:21 grangeway Status resolved => acknowledged
2013-04-06 08:28 grangeway Status acknowledged => closed
2013-09-01 05:48 dregad Relationship added related to 0016344
2016-01-28 03:34 rombert Relationship added has duplicate 0020545