9 namespace PhpXmlRpc\Helper;
15 * Echoes a debug message, taking care of escaping it when not in console mode.
16 * NB: if the encoding of the message is not known or wrong, and we are working in web mode, there is no guarantee
17 * of 100% accuracy, which kind of defeats the purpose of debugging
19 * @param string $message
20 * @param string $encoding
22 public static function debugMessage($message, $encoding=null)
24 if (PHP_SAPI != 'cli') {
25 $flags = ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE;
26 if ($encoding != null) {
27 print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>";
29 print "<PRE>\n".htmlentities($message, $flags)."\n</PRE>";
35 // let the user see this now in case there's a time out later...