In this function

function _bundle_copy_commerce_bundle_info($entity_type, $table_select = FALSE) {
  static $bundles = array();

  if (!isset($bundles[$entity_type])) {

    $bundles[$entity_type] = array();
    $commerce_product_types = commerce_product_types();
    foreach ($commerce_product_types as $type => $product_type) {
      if ($table_select) {
        $commerce_bundles[$type]['machine_name'] = $type;
        $commerce_bundles[$type]['label'] = $product_type['name'];
      }
      else {
        $commerce_bundles[$type][$type] = $product_type['name'];
      }
    }
  }
  return $commerce_bundles;
}

should $commerce_bundles be $bundles[$entity_type]? as it is, it only puts an empty array in that static array and otherwise doesn't touch it. it seems like the 2nd time you call this function in a single session you're going to get NULL instead of the info you got the 1st time.

Comments

fizk’s picture

Project: Bundle Copy » Bundle Copy Commerce
Version: 7.x-2.x-dev » 7.x-1.x-dev

Moving to new Bundle Copy Commerce module.

fizk’s picture

Title: typo in bundle_copy_commerce module code? » Fix use of static variable
Status: Active » Fixed

Good catch! I've fixed this in dev.

  • fizk committed 15c7760 on 7.x-1.x
    #2336361: Fix use of static variable.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.