Same name and namespace in other branches
  1. 4.7.x includes/bootstrap.inc \drupal_unpack()
  2. 5.x includes/bootstrap.inc \drupal_unpack()
  3. 6.x includes/bootstrap.inc \drupal_unpack()
  4. 7.x includes/bootstrap.inc \drupal_unpack()

Unserializes and appends elements from a serialized string.

Parameters

$obj: The object to which the elements are appended.

$field: The attribute of $obj whose value should be unserialized.

7 calls to drupal_unpack()
comment_admin_edit in modules/comment.module
Menu callback; edit a comment from the administrative interface.
comment_edit in modules/comment.module
comment_preview in modules/comment.module
comment_reply in modules/comment.module
node_load in modules/node.module
Load a node object from the database.

... See full list

File

includes/bootstrap.inc, line 496
Functions that need to be loaded on every Drupal request.

Code

function drupal_unpack($obj, $field = 'data') {
  if ($obj->{$field} && ($data = unserialize($obj->{$field}))) {
    foreach ($data as $key => $value) {
      if (!isset($obj->{$key})) {
        $obj->{$key} = $value;
      }
    }
  }
  return $obj;
}