If you remove all product types you get this on some pages. I'm not sure it's important, as it's an unusual occurrence, but :

Notice: Undefined index: commerce_product in field_info_instances() (line 682 of /home/rfay/workspace/commerce/modules/field/field.info.inc). Backtrace:
field_info_instances('commerce_product') commerce_product_reference.module:40
commerce_product_reference_field_extra_fields()
call_user_func_array('commerce_product_reference_field_extra_fields', Array) module.inc:819
module_invoke_all('field_extra_fields') field.info.inc:231
_field_info_collate_fields() field.info.inc:658
field_info_field_by_ids() field.attach.inc:603
field_attach_load('rules_config', Array) entity.controller.inc:633
EntityAPIControllerExportable->attachLoad(Array, ) rules.core.inc:36
RulesEntityController->attachLoad(Array, ) entity.controller.inc:230
EntityAPIController->load(, Array) entity.controller.inc:532
EntityAPIControllerExportable->load(, Array) common.inc:7448
entity_load('rules_config', , Array) entity.module:143
entity_load_multiple_by_name('rules_config', , Array) rules.module:603
rules_config_load_multiple(, Array) rules.plugins.inc:696
RulesEventSet->rebuildCache(Array, Array) rules.module:260
_rules_rebuild_cache(Array) rules.module:239
rules_get_cache('data') rules.module:232
rules_get_cache('event_init') rules.module:722
rules_invoke_event('init') rules.module:26
rules_init()
call_user_func_array('rules_init', Array) module.inc:819
module_invoke_all('init') common.inc:4942
_drupal_bootstrap_full() bootstrap.inc:1933
drupal_bootstrap(7) index.php:20
Files: 
CommentFileSizeAuthor
#24 1245332-field_info_instances_fix_returns-24-d7.patch3.6 KBDave Reid
PASSED: [[SimpleTest]]: [MySQL] 38,324 pass(es).
[ View ]
#14 field_info_instances_fix_returns-1245332-14-7.x.patch3.6 KBwillvincent
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [git://git.drupal.org/project/drupal.git].
[ View ]
#14 field_info_instances_fix_returns-1245332-14-7.x.p0.patch3.51 KBwillvincent
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch field_info_instances_fix_returns-1245332-14-7.x.p0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#10 1245332-field-info-intances-fix-returns.patch3.63 KBDave Reid
PASSED: [[SimpleTest]]: [MySQL] 34,585 pass(es).
[ View ]
#6 1245332-field-info-intances-fix-returns.patch3.65 KBDave Reid
PASSED: [[SimpleTest]]: [MySQL] 34,590 pass(es).
[ View ]
#4 1245332-field-info-intances-fix-returns.patch2.88 KBDave Reid
FAILED: [[SimpleTest]]: [MySQL] 34,577 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#1 drupal.field_info_instances_warning.patch556 bytesrfay
PASSED: [[SimpleTest]]: [MySQL] 33,632 pass(es).
[ View ]

Comments

Project:Drupal Commerce» Drupal core
Version:7.x-1.x-dev» 8.x-dev
Component:Commerce» entity system
Status:Active» Needs review
Issue tags:+needs backport to D7
StatusFileSize
new556 bytes
PASSED: [[SimpleTest]]: [MySQL] 33,632 pass(es).
[ View ]

This is a core problem. The attached patch works around this problem.

Status:Needs review» Reviewed & tested by the community

Look sensible as far as I can see.

Status:Reviewed & tested by the community» Needs work
Issue tags:+Needs tests

+++ b/modules/field/field.info.inc
@@ -678,7 +678,7 @@ function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
-  if (!isset($bundle_name)) {
+  if (!isset($bundle_name) && !empty($info['instances'][$entity_type])) {
     return $info['instances'][$entity_type];
   }

I think we need to use a ternary operator in the return value - otherwise, we're not entering the condition when we're supposed to.

Second, this looks important enough for me to require tests.

20 days to next Drupal core point release.

Status:Needs work» Needs review
Issue tags:-Needs tests
StatusFileSize
new2.88 KB
FAILED: [[SimpleTest]]: [MySQL] 34,577 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

This is the syntax I'm used to for this type of double-optional function which also makes the most sense to me. Adding tests.

Status:Needs review» Needs work

The last submitted patch, 1245332-field-info-intances-fix-returns.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new3.65 KB
PASSED: [[SimpleTest]]: [MySQL] 34,590 pass(es).
[ View ]

Revised patch, passes tests.

Status:Needs review» Needs work

Code looks good, however the test is wrong :
$instances = field_info_instances('test_entity'); is always keyed by the bundles known for the entity type (known = exposed in hook_entity_info())

Isn't that what we're testing?

Status:Needs work» Reviewed & tested by the community

Ooops, crosspost, my comment was for patch #4.

RTBC :-)

StatusFileSize
new3.63 KB
PASSED: [[SimpleTest]]: [MySQL] 34,585 pass(es).
[ View ]

Small change to the assertion messages, no functional change so leaving RTBC.

Version:8.x-dev» 7.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

Thanks!

Committed/pushed to 8.x, moving to 7.x for backport.

Assigned:Unassigned» purencool

Assigned:purencool» Unassigned

StatusFileSize
new3.51 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch field_info_instances_fix_returns-1245332-14-7.x.p0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
new3.6 KB
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [git://git.drupal.org/project/drupal.git].
[ View ]

Rerolled patch from #10 for D7.

I've also included p0 format patch for the benefit of those not using a git checkout of core.

Status:Patch (to be ported)» Needs review

Moving to 'needs review'.

Status:Needs review» Needs work

The last submitted patch, field_info_instances_fix_returns-1245332-14-7.x.p0.patch, failed testing.

To make a patch not be tested, name it like
field_info_instances_...-p0-do-not-test.patch

But anybody using the patch tool can use patch -p1 with a standard git patch.

Good call, though I don't believe it's possible to specify that -p1 flag with drush make

drush make has handled git-style patches for many months now.

But will they apply to a project that's not checked out from the git repo?

EDIT: Just tested that myself, and color me surprised.. it sure does. Thanks for the info on that Randy, I had no idea drush make would apply a git patch to a project that's downloaded rather than cloned from the repo. :)

Yes, git patches are just patch -p1 patches. nothing special.

Drush make added support for all regular git patches in the issue queue in #745224-132: Apply patches from git diff and git format-patch in July, 2011.

At any rate, the patch in #14 does apply cleanly and resolves this issue.

I don't seem to be able to run the tests locally at all without them simply timing out and failing. Probably a server config issue I imagine, but I'm not clear why the one test is failing with the testbot, that shouldn't be affected by this patch at all as far as I can tell.

Queuing for re-test.

Status:Needs work» Needs review

StatusFileSize
new3.6 KB
PASSED: [[SimpleTest]]: [MySQL] 38,324 pass(es).
[ View ]

Re-uploading D7 patch only.

I have tested #24 and I can confirm that it seems to resolve the issue, thank you!

Feel free to mark this issue as 'reviewed and tested by the community' then so we can get this fixed in Drupal 7. :)

Status:Needs review» Reviewed & tested by the community

yup, same as for D8

Weird. Why did it pass when you uploaded it?

Version:7.x-dev» 8.x-dev

Bumping to d8 because it needs to go in there first

Version:8.x-dev» 7.x-dev

My bad

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 7.x. Thanks!

Status:Fixed» Closed (fixed)

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

FYI I did a fresh install of D7.12 and some modules. I deleted all content types and then got this message:

The content type Basic page has been deleted.
Error message
    Notice: Undefined index: comment in field_info_instances() (line 687 of ../domain/modules/field/field.info.inc).
    Notice: Undefined index: node in field_info_instances() (line 687 of ../domain/modules/field/field.info.inc).
    Add content type
Name Operations
No content types available. Add content type.

I installed the patch in #24 and the error messages disappeared after the cache was cleared. So that worked, thanks :)

it works for me too

Did this ever make it to a stable release? I don't see a note anywhere

Issue tags:-needs backport to D7

It was committed to D7 on March 11, so is part of 7.14. The commit was http://drupalcode.org/project/drupal.git/commitdiff/f145e08cfd0c67f05ec8...