You are here

function drupal_unpack in Drupal 5

Same name and namespace in other branches
  1. 4 includes/bootstrap.inc \drupal_unpack()
  2. 6 includes/bootstrap.inc \drupal_unpack()
  3. 7 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.

6 calls to drupal_unpack()
comment_edit in modules/comment/comment.module
comment_form_add_preview in modules/comment/comment.module
comment_render in modules/comment/comment.module
Renders comment(s).
comment_reply in modules/comment/comment.module
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
sess_read in includes/session.inc

... See full list

File

includes/bootstrap.inc, line 644
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;
}