Page MenuHomePhorge

D4701.1775235332.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D4701.1775235332.diff

diff --git a/lib/ext/Syncroton/Model/AXMLEntry.php b/lib/ext/Syncroton/Model/AXMLEntry.php
--- a/lib/ext/Syncroton/Model/AXMLEntry.php
+++ b/lib/ext/Syncroton/Model/AXMLEntry.php
@@ -222,6 +222,31 @@
return $dirty;
}
+ /**
+ * Fix date-time string input
+ *
+ * @param string $date Date time string
+ *
+ * @return string
+ */
+ protected function _fixDateTimeString($date)
+ {
+ // Note: Some clients send date-time in local charset instead of ascii
+ // It is not supported by PHP DateTime constructor
+
+ $from = [
+ '١','٢','٣','٤','٥','٦','٧','٨','٩','٠', // arabic
+ '۱','۲','۳','۴','۵','۶','۷','۸','۹','۰', // persian
+ ];
+
+ $to = [
+ '1','2','3','4','5','6','7','8','9','0',
+ '1','2','3','4','5','6','7','8','9','0',
+ ];
+
+ return str_replace($from, $to, $date);
+ }
+
/**
*
* @param string $element
@@ -284,7 +309,7 @@
break;
case 'datetime':
- $property = new DateTime((string) $xmlElement, new DateTimeZone('UTC'));
+ $property = new DateTime($this->_fixDateTimeString((string) $xmlElement), new DateTimeZone('UTC'));
break;
case 'number':

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 4:55 PM (10 h, 55 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18824255
Default Alt Text
D4701.1775235332.diff (1 KB)

Event Timeline