Less specific date type detection
authorSurgie <finesserus@gmail.com>
Wed, 14 Jun 2017 08:46:52 +0000 (18:46 +1000)
committerGitHub <noreply@github.com>
Wed, 14 Jun 2017 08:46:52 +0000 (18:46 +1000)
src/Encoder.php

index 220ce88..dfec15d 100644 (file)
@@ -63,11 +63,11 @@ class Encoder
                         $out = strtotime($out);
                     }
                     if (is_int($out)) {
                         $out = strtotime($out);
                     }
                     if (is_int($out)) {
-                        $result = new \Datetime();
+                        $result = new \DateTime();
                         $result->setTimestamp($out);
 
                         return $result;
                         $result->setTimestamp($out);
 
                         return $result;
-                    } elseif (is_a($out, 'Datetime')) {
+                    } elseif (is_a($out, 'DateTimeInterface')) {
                         return $out;
                     }
                 }
                         return $out;
                     }
                 }
@@ -179,7 +179,7 @@ class Encoder
             case 'object':
                 if (is_a($phpVal, 'PhpXmlRpc\Value')) {
                     $xmlrpcVal = $phpVal;
             case 'object':
                 if (is_a($phpVal, 'PhpXmlRpc\Value')) {
                     $xmlrpcVal = $phpVal;
-                } elseif (is_a($phpVal, 'DateTime')) {
+                } elseif (is_a($phpVal, 'DateTimeInterface')) {
                     $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
                 } else {
                     $arr = array();
                     $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
                 } else {
                     $arr = array();