summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--includes/export.inc7
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 856dcf1..5bce610 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -29,6 +29,7 @@ Show a LOCK icon on the page list when pages are locked for editing either by th
Change plugins to no longer need magic function. Can now use $plugin = array(...) instead.
#651852 by coreyp_1: Add caching to content subtypes to save some queries. This means developers will need to clear caches when changing content type code.
#630982 by Roi Danton: Dependent javascript failed to work properly if radios being depended on had no value at all.
+#661332 by yhahn: Allow export.inc to export stdClass objects by exporting them as an array and casting them to an object.
ctools 6.x-1.x-dev
==================
diff --git a/includes/export.inc b/includes/export.inc
index 9d64721..177faa6 100644
--- a/includes/export.inc
+++ b/includes/export.inc
@@ -345,6 +345,13 @@ function ctools_var_export($var, $prefix = '') {
$output .= ')';
}
}
+ else if (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) ' . ctools_var_export((array) $var);
+ }
else if (is_bool($var)) {
$output = $var ? 'TRUE' : 'FALSE';
}