Skip to content

Commit fbbf1d2

Browse files
committedNov 14, 2012
SOAP API: add failing test for retrieving issue text in non-latin charsets
Affects #14157: Array to string conversion error on soap request with PHP 5.4
1 parent eac6b08 commit fbbf1d2

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
 

‎api/soap/mc_issue_api.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function mc_issue_get( $p_username, $p_password, $p_issue_id ) {
8080
$t_issue_data['status'] = mci_enum_get_array_by_id( $t_bug->status, 'status', $t_lang );
8181

8282
$t_issue_data['reporter'] = mci_account_get_array_by_id( $t_bug->reporter_id );
83-
$t_issue_data['summary'] = $t_bug->summary;
83+
$t_issue_data['summary'] = mci_sanitize_xml_string($t_bug->summary);
8484
$t_issue_data['version'] = mci_null_if_empty( $t_bug->version );
8585
$t_issue_data['build'] = mci_null_if_empty( $t_bug->build );
8686
$t_issue_data['profile_id'] = mci_null_if_empty( $t_bug->profile_id );

‎tests/soap/IssueAddTest.php

+27
Original file line numberDiff line numberDiff line change
@@ -543,4 +543,31 @@ public function testCreateIssueWithFieldsByName() {
543543
$this->assertEquals( $issueToAdd['resolution']['name'], $issue->resolution->name);
544544
$this->assertEquals( $issueToAdd['status']['name'], $issue->status->name);
545545
}
546+
547+
/**
548+
* A test cases that tests the creation of issues with non-latin text, to validate that
549+
* it is not stripped.
550+
*/
551+
public function testCreateIssueWithNonLatinText() {
552+
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithNonLatinText' );
553+
554+
$issueToAdd['summary'] = "Здравствуйте!"; // Russian, hello
555+
$issueToAdd['description'] = "你好";// Mandarin Chinese, hello
556+
557+
$issueId = $this->client->mc_issue_add(
558+
$this->userName,
559+
$this->password,
560+
$issueToAdd);
561+
562+
$this->deleteAfterRun( $issueId );
563+
564+
$issue = $this->client->mc_issue_get(
565+
$this->userName,
566+
$this->password,
567+
$issueId);
568+
569+
// explicitly specified fields
570+
$this->assertEquals( $issueToAdd['summary'], $issue->summary , 'summary is not correct');
571+
$this->assertEquals( $issueToAdd['description'], $issue->description , 'description is not correct');
572+
}
546573
}

0 commit comments

Comments
 (0)
Please sign in to comment.