+XML-RPC for PHP version 4.8.1 - unreleased
+
+* improved: remove warnings with php 8.1 due to usage of strftime
+
+* improved: cast correctly php objects sporting `DateTimeInterface` to phpxmlrpc datetime values
+
+
XML-RPC for PHP version 4.8.0 - 2022/6/20
* fixed: the `benchmark.php` file had seen some tests accidentally dropped
echo "<h3>$protoName call FAILED!</h3>\n";
echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
"] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n";
- echo(strftime("%d/%b/%Y:%H:%M:%S\n"));
+ echo(date("d/M/Y:H:i:s\n"));
} else {
// call succeeded: parse results
//echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>';
printf("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoName, $time);
- echo(strftime("%d/%b/%Y:%H:%M:%S\n"));
+ echo(date("d/M/Y:H:i:s\n"));
switch ($action) {
case 'list':
public static function iso8601Encode($timet, $utc = 0)
{
if (!$utc) {
- $t = strftime("%Y%m%dT%H:%M:%S", $timet);
+ $t = date('Ymd\TH:i:s', $timet);
} else {
- if (function_exists('gmstrftime')) {
- // gmstrftime doesn't exist in some versions of PHP
- $t = gmstrftime("%Y%m%dT%H:%M:%S", $timet);
- } else {
- $t = strftime("%Y%m%dT%H:%M:%S", $timet - date('Z'));
- }
+ $t = gmdate('Ymd\TH:i:s', $timet);
}
return $t;
}
/**
- * @param string typ
+ * @param string $typ
* @param Value[]|mixed $val
* @param string $charsetEncoding
* @return string
case static::$xmlrpcDateTime:
if (is_string($val)) {
$rs .= "<${typ}>${val}</${typ}>";
- } elseif (is_a($val, 'DateTime')) {
+ } elseif (is_a($val, 'DateTime') || is_a($val, 'DateTimeInterface')) {
$rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
} elseif (is_int($val)) {
- $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>";
+ $rs .= "<${typ}>" . date('Ymd\TH:i:s', $val) . "</${typ}>";
} else {
// not really a good idea here: but what shall we output anyway? left for backward compat...
$rs .= "<${typ}>${val}</${typ}>";