Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117768620
D4701.1775235332.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D4701.1775235332.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4701: Fix error on arabic date input
Attached
Detach File
Event Timeline