Hello,

Context:

One of my contrib modules is causing an error in the following hook: contribmodule_form_taxonomy_overview_terms_alter(...).

The error is due to the following missing index: form[#vocabulary]

*****

Effort to understand the problem:

I wanted to learn a little about the form taxonomy_overview_terms to understand what is going on. I copied the taxonomy folder from /modules to /sites/all/modules. I just wanted to go in and add some dpm(...) statements and understand how the form is being created and why the above index was not included. But doing this and then running "$drush cc all" crashed my server.

*****

Can someone help me understand what I did wrong? Is this a wrong approach? I'm on a test server, and now I feel foolish for not just hacking up the core taxonomy folder and then restoring when I'm done.

Thank you very much,
Ann

Comments

nevets’s picture

What is the contributed module?

It is not clear what you are doing but " I copied the taxonomy folder from /modules to /sites/all/modules." is likely to cause problems. And you should not be modify core files.

ann b’s picture

Thank you so much for responding @nevets.

Here is a clarification of what I am trying to achieve.

1. The contributed module is Media Browser Plus for Media 2.x - 7.x-3.0-beta2.

2. When I navigate to the structure / taxonomy page, select my taxonomy group, and then press the Reset to Alphabetical Order button, I receive the following errors:

Notice: Undefined index: #vocabulary in media_browser_plus_form_taxonomy_overview_terms_alter() (line 678 of /sites/all/modules/media_browser_plus-7.x-3.0-beta2/media_browser_plus/media_browser_plus.module).

Notice: Trying to get property of non-object in media_browser_plus_form_taxonomy_overview_terms_alter() (line 678 of /sites/all/modules/media_browser_plus-7.x-3.0-beta2/media_browser_plus/media_browser_plus.module).

3. What I was trying to do was figure out why the form[#vocabulary] index was missing. I just wanted to understand how the taxonomy_overview_terms form was being created and why this index would be missing.

*****

The system programmer brought my server back up. Now my website won't come up at all. I'm getting the following errors:

Warning: array_keys() expects parameter 1 to be array, null given in drupal_schema_fields_sql() (line 7070 of /includes/common.inc).
Warning: array_keys() expects parameter 1 to be array, null given in drupal_schema_fields_sql() (line 7070 of /includes/common.inc).
Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be of the type array, null given, called in /includes/entity.inc on line 279 and defined in SelectQuery->fields() (line 1300 of /includes/database/select.inc).

*****

I'm going to attempt to restore. Lesson learned. I will never touch a core module again, even in the test environment. It is very dangerous! I thought it would be okay for debugging on a test server, it's not okay!

Thanks again,
Ann

jamix’s picture

The issue was probably caused by creating a second copy of the Taxonomy module in sites/all/modules. Remove that, and add your dpm() calls to the core module itself (modules/taxonomy/taxonomy.module or whatever file you need). Just make sure to remove that extra code after you're done with debugging.

ann b’s picture

Thank you. I've created a drupal site on a local PC just for debugging and practicing. I will be able to recover from any disasters without too much trouble. I can try your suggestion there. And I'll be sure not to move any of the core module folders again. I was confused because I did move the bartik theme folder down to /sites/all/themes to create a sub-theme, so I thought modules would work the same way. They do not. I understand now.