From 730f77f2f9ed5030f392d7d8f81fb59ffd34c500 Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 24 Nov 2011 13:04:25 -0800 Subject: Issue #1182296 by BTMash, matason, catch, xjm: Add tests for 7.0->7.x upgrade path. --- includes/utility.inc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'includes') diff --git a/includes/utility.inc b/includes/utility.inc index df6c48fb9..d195bff74 100644 --- a/includes/utility.inc +++ b/includes/utility.inc @@ -46,6 +46,13 @@ function drupal_var_export($var, $prefix = '') { $output = "'" . $var . "'"; } } + elseif (is_object($var) && get_class($var) === 'stdClass') { + // var_export() will export stdClass objects using an undefined + // magic method __set_state() leaving the export broken. This + // workaround avoids this by casting the object as an array for + // export and casting it back to an object when evaluated. + $output .= '(object) ' . drupal_var_export((array) $var, $prefix); + } else { $output = var_export($var, TRUE); } -- cgit v1.2.3