Repository: kbsali/php-redmine-api (php)

Issue:
Create time entry fails due simplexml entity error
Can not create/update a time entry which contains xml entities in comments field:

```
$client->time_entry->create([
    'issue_id' => $id,
    'spent_on' => $spentOn,
    'hours' => $hours,
    'activity_id' => $activityId,
    'comments' => 'some text with xml entities: & < > '
]);
```

`SimpleXMLElement::addChild(): unterminated entity reference`





Pull request description:
Handle xml entities in time_entry comments correct
Fixes #233

Patch:
diff --git a/src/Redmine/Api/TimeEntry.php b/src/Redmine/Api/TimeEntry.php
index 1f70ea2..81966b2 100644
--- a/src/Redmine/Api/TimeEntry.php
+++ b/src/Redmine/Api/TimeEntry.php
@@ -78,7 +78,7 @@ class TimeEntry extends AbstractApi
             if ('custom_fields' === $k && is_array($v)) {
                 $this->attachCustomFieldXML($xml, $v);
             } else {
-                $xml->addChild($k, $v);
+                $xml->addChild($k, htmlspecialchars($v));
             }
         }
 


Test patch:
diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php
index 38b01d0..cc00c26 100644
--- a/tests/Unit/Api/TimeEntryTest.php
+++ b/tests/Unit/Api/TimeEntryTest.php
@@ -232,6 +232,7 @@ class TimeEntryTest extends TestCase
             'issue_id' => '15',
             'project_id' => '25',
             'hours' => '5.25',
+            'comments' => 'some text with xml entities: & < > " \' ',
             'custom_fields' => [
                 [
                     'id' => 1,