return null;
}
- if (is_bool($input)) {
+ if (is_bool($input) || is_int($input) || is_float($input) || $input instanceof DateTimeInterface) {
return $input;
}
if (is_array($input)) {
$out = array();
foreach ($input as $key => $value) {
- $out[$key] = escape($value);
+ $out[escape($key)] = escape($value);
}
return $out;
}
{
return dn__($domain, $text, $nText, $nb);
}
+
+/**
+ * Converts an exception into a printable stack trace string.
+ */
+function exception2text(Throwable $e): string
+{
+ return $e->getMessage() . PHP_EOL . $e->getFile() . $e->getLine() . PHP_EOL . $e->getTraceAsString();
+}
+