MantisBT

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014157mantisbtapi soappublic2012-04-16 08:072013-09-01 05:48
Reporterchrstph 
Assigned Torombert 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
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
DescriptionI 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>

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 ReproduceSOAPUI4, call mc_projects_get_user_accessible with a valid user/password.
TagsNo tags attached.
Attached Files

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

-  Notes
User avatar (0031677)
rombert (developer)
2012-04-17 11:59

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?
User avatar (0031683)
chrstph (reporter)
2012-04-18 07:16

Windows: XP (localhost: web client, soapui and server)
Apache: 2.2
PHP: 5.4.0
SOAP UI: 4.0.1
User avatar (0031684)
rombert (developer)
2012-04-18 08:06

This might be an PHP 5.4.0 issue . Can you try with PHP 5.3.x ?
User avatar (0031690)
chrstph (reporter)
2012-04-19 03:31

Hi,

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

Thanks for your time.
User avatar (0031691)
rombert (developer)
2012-04-19 05:05

If the problem is PHP 5.4 we should fix this in the near future, but it's not such high priority.
User avatar (0031910)
qingwl (reporter)
2012-05-28 04:20

Hi,

I got the same errors when trying on most of the methods, e.g. 'mc_enum_project_status' on PHP 5.3.2.
User avatar (0031915)
rombert (developer)
2012-05-28 15:02

(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.
User avatar (0031984)
vboctor (administrator)
2012-06-02 18:46

@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?
User avatar (0032026)
rombert (developer)
2012-06-05 15:19

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 [^] .
User avatar (0032092)
rombert (developer)
2012-06-13 16:40

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?
User avatar (0032165)
papoanaya (reporter)
2012-06-24 18:23
edited on: 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);
}

...

User avatar (0032173)
rombert (developer)
2012-06-25 08:26

Great, thanks for letting us know. I think we should look into patching this ourselves before nusoap comes up with a new release.
User avatar (0032820)
skeyby (reporter)
2012-09-11 09:11

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.
User avatar (0033170)
dennis (reporter)
2012-10-11 23:26

yes, it's php 5.4.x issue.
I have the same issue.
User avatar (0033406)
rombert (developer)
2012-11-01 16:20

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?
User avatar (0034305)
rombert (developer)
2012-11-12 17:18

The next version supports using the php5 soap extension if it is present, and by definition this supports PHP 5.4.
User avatar (0034309)
dust (reporter)
2012-11-14 03:45

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);
}
User avatar (0034310)
rombert (developer)
2012-11-14 03:55

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.
User avatar (0034326)
dregad (developer)
2012-11-15 13:34
edited on: 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 [^]

User avatar (0034329)
rombert (developer)
2012-11-15 15:03

The fix works fine for my test ( Russian, Mandarin Chinese ). Thanks!
User avatar (0034351)
papoanaya (reporter)
2012-11-19 18:53

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
User avatar (0036129)
grangeway (developer)
2013-04-05 17:56

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

- Related Changesets
MantisBT: master 7ae2d9ae
Timestamp: 2012-11-15 20:01:22
Author: 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
Timestamp: 2012-11-15 20:01:22
Author: 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


MantisBT 1.2.17 [^]
Copyright © 2000 - 2014 MantisBT Team
Time: 0.1212 seconds.
memory usage: 3,303 KB
Powered by Mantis Bugtracker