/** * Print out the variable context given * @param array $p_context Error context. * @return void */ function error_print_context(array $p_context) { if (!is_array($p_context)) { return; } echo '<table class="width100" style="table-layout:fixed;"><tr><th>Variable</th><th>Value</th><th>Type</th></tr>'; # print normal variables foreach ($p_context as $t_var => $t_val) { if (!is_array($t_val) && !is_object($t_val)) { $t_type = gettype($t_val); $t_val = htmlentities((string) $t_val, ENT_COMPAT, 'UTF-8'); # Mask Passwords if (strpos($t_var, 'password') !== false) { $t_val = '**********'; } echo '<tr><td style="width=20%; word-wrap:break-word; overflow:auto;">', $t_var, '</td><td style="width=70%; word-wrap:break-word; overflow:auto;">', $t_val, '</td><td style="width=10%;">', $t_type, '</td></tr>', "\n"; } } # print arrays foreach ($p_context as $t_var => $t_val) { if (is_array($t_val) && $t_var != 'GLOBALS') { echo '<tr><td colspan="3" style="word-wrap:break-word"><br /><strong>', $t_var, '</strong></td></tr>'; echo '<tr><td colspan="3">'; error_print_context($t_val); echo '</td></tr>'; } } echo '</table>'; }
function error_print_context($p_context) { if (!is_array($p_context)) { return; } print '<table class="width100"><tr><th>Variable</th><th>Value</th><th>Type</th></tr>'; # print normal variables foreach ($p_context as $t_var => $t_val) { if (!is_array($t_val) && !is_object($t_val)) { $t_val = string_html_entities((string) $t_val); $t_type = gettype($t_val); # Mask Passwords if (strpos($t_var, 'password') !== false) { $t_val = '**********'; } print "<tr><td>{$t_var}</td><td>{$t_val}</td><td>{$t_type}</td></tr>\n"; } } # print arrays foreach ($p_context as $t_var => $t_val) { if (is_array($t_val) && $t_var != 'GLOBALS') { print "<tr><td colspan=\"3\" align=\"left\"><br /><strong>{$t_var}</strong></td></tr>"; print "<tr><td colspan=\"3\">"; error_print_context($t_val); print "</td></tr>"; } } print '</table>'; }
/** * Print out the variable context given * @param string $p_context * @return null */ function error_print_context($p_context) { if (!is_array($p_context)) { return; } echo '<table class="width100"><tr><th>Variable</th><th>Value</th><th>Type</th></tr>'; # print normal variables foreach ($p_context as $t_var => $t_val) { if (!is_array($t_val) && !is_object($t_val)) { $t_type = gettype($t_val); $t_val = htmlentities((string) $t_val, ENT_COMPAT, 'UTF-8'); # Mask Passwords if (strpos($t_var, 'password') !== false) { $t_val = '**********'; } echo '<tr><td>', $t_var, '</td><td>', $t_val, '</td><td>', $t_type, '</td></tr>', "\n"; } } # print arrays foreach ($p_context as $t_var => $t_val) { if (is_array($t_val) && $t_var != 'GLOBALS') { echo '<tr><td colspan="3" align="left"><br /><strong>', $t_var, '</strong></td></tr>'; echo '<tr><td colspan="3">'; error_print_context($t_val); echo '</td></tr>'; } } echo '</table>'; }