Commit 9043009d authored by yched's avatar yched

followup fix for #736440 - prevent "Fatal error: __clone method called on...

followup fix for #736440 - prevent "Fatal error: __clone method called on non-object" reported in #988890
parent c0d2f432
......@@ -24,12 +24,12 @@ function token_content_build_modes() {
function content_token_values($type, $object = NULL) {
$tokens = array();
if ($type == 'node') {
// Let PHP free the $node object when we are done. Working directly on the
// incoming $object causes memory leak issues on long-running scripts such
// as migrations. See http://drupal.org/node/736440.
$node = clone $object;
// Prevent against invalid 'nodes' built by broken 3rd party code.
if (isset($node->type)) {
if (isset($object->type)) {
// Let PHP free the $node object when we are done. Working directly on the
// incoming $object causes memory leak issues on long-running scripts such
// as migrations. See http://drupal.org/node/736440.
$node = clone $object;
$type = content_types($node->type);
$node->build_mode = 'token';
$node->content = array();
......
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