you know the drill... variables should be set before they are used...
* notice: Undefined offset: 0 in /path/to/all/modules/ubercart/uc_product/uc_product.module on line 362.
355 /**
356 * Implementation of hook_forms().
357 *
358 * Register an "add to cart" form for each product to prevent id collisions.
359 */
360 function uc_product_forms($form_id, $args) {
361 $forms = array();
362 $product = $args[0];
363 if (in_array($product->type, array_keys(uc_product_node_info()))) {
364 $forms['uc_product_add_to_cart_form_'. $product->nid] = array('callback' => 'uc_product_ad d_to_cart_form');
365 $forms['uc_catalog_buy_it_now_form_'. $product->nid] = array('callback' => 'uc_catalog_buy _it_now_form');
366 }
367 return $forms;
368 }
* notice: Trying to get property of non-object in /path/to/all/modules/ubercart/uc_product/uc_product.module on line 363.
see above.
* notice: Undefined offset: 0 in /path/to/all/modules/ubercart/uc_product_kit/uc_product_kit.module on line 349.
347 function uc_product_kit_forms($form_id, $args) {
348 $forms = array();
349 $product = $args[0];
350 if ($product->type == 'product_kit') {
351 $forms['uc_product_kit_add_to_cart_form_'. $product->nid] = array('callback' => 'uc_product _kit_add_to_cart_form');
352 $forms['uc_product_add_to_cart_form_'. $product->nid] = array('callback' => 'uc_product_kit _add_to_cart_form');
353 $forms['uc_catalog_buy_it_now_form_'. $product->nid] = array('callback' => 'uc_product_kit_ buy_it_now_form');
354 }
355 return $forms;
356 }
* notice: Trying to get property of non-object in /path/to/all/modules/ubercart/uc_product_kit/uc_product_kit.module on line 350.
see above.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | unset_product_forms.patch | 2.17 KB | Island Usurper |
| #1 | 396700.hook_forms.2.x.patch | 2.28 KB | cha0s |
Comments
Comment #1
cha0s commentedIt looks like Lyle changed the behavior of the hook_forms() implementations in rev. 1531.
I'm not sure why he did, if he has another plan but forgot to finish it... anyways I have a patch here that fixes the problem using some tests, but I dunno, should we just use strpos?
Comment #2
cha0s commentedComment #3
Island Usurper commentedIt was a regression that slipped in when 1531 was committed. There used to be a query there which certainly wasn't necessary, but the fix took out too much.
array_key_exists() won't work on objects once people start using PHP 5.3, so I think it should be isset(). property_exists() isn't available until 5.1, but there might still be some people using 5.0 if that's our official minimum requirement.