Commit 97874c4b authored by Mike Carper's avatar Mike Carper

Issue #2008440 by mikeytown2: Fix Fatal error: Cannot write property when using httprl_pr().

parent 0acded75
......@@ -2429,9 +2429,19 @@ function httprl_lock_release($name) {
function httprl_print_empty(&$data, $level = 0) {
$level++;
if ($level < 10 ) {
if (is_object($data) && !method_exists($data, '__set')) {
foreach ($data as $key => $values) {
$data->{$key} = httprl_print_empty($values, $level);
if (is_object($data)) {
if (method_exists($data, '__set') || get_class($data) != 'stdClass') {
$new_object = new stdClass;
$new_object->__original_class_name__ = get_class($data);
foreach ($data as $key => $values) {
$new_object->{$key} = httprl_print_empty($values, $level);
}
$data = $new_object;
}
else {
foreach ($data as $key => $values) {
$data->{$key} = httprl_print_empty($values, $level);
}
}
}
elseif (is_array($data)) {
......@@ -2454,19 +2464,20 @@ function httprl_print_empty(&$data, $level = 0) {
/**
* Pretty print data.
*
* @param $data
* @param $input
* Data In.
* @return
* Human readable HTML version of the data.
*/
function httprl_pr($data) {
function httprl_pr($input) {
$old_setting = ini_set('mbstring.substitute_character', '"none"');
// Get extra arguments passed in.
$data = func_get_args();
$input = func_get_args();
// If bool or strlen = 0 use var_export on that variable.
$data = httprl_print_empty($data);
$input = unserialize(serialize($input));
$data = httprl_print_empty($input);
// Merge into base array if only one argument passed in.
if (count($data) == 1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment