drupal_unpack

  1. drupal
    1. 4.7
    2. 5
    3. 6 bootstrap.inc
    4. 7 bootstrap.inc
Versions
4.7 – 7 drupal_unpack($obj, $field = 'data')

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.

Code

includes/bootstrap.inc, line 591

<?php
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;
}
?>