summaryrefslogtreecommitdiff
path: root/includes/utility.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/utility.inc')
-rw-r--r--includes/utility.inc7
1 files changed, 7 insertions, 0 deletions
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);
}