After installation of the (Default Content) module (with OpenEnterprise Drupal installation profile), everything seemed to go well. But after a short time (of was it immediately after module installation?), the module list would not load anymore, and neither would the site's home page. After turning on detailed error reporting in index.php, a fatal error message showed up (see first comment for line number). Another error message related to the same module (and equally another undefined function, but different error) came up on the modules list page (equally refer to first comment for exact message).
The only solution was to disable the defaultcontent module (and dependant modules) in database, and everything was working fine again.
This issue came up in different environments, exactly the same messages.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bitbull’s picture

Title: Call to undefined function context_get_plugin() ... defaultcontent.module » Fatal error: Call to undefined function context_get_plugin() in modules/defaultcontent/defaultcontent.module

Error message on modules list page:
Fatal error: Class 'context_condition' not found in profiles/openenterprise/modules/defaultcontent/plugins/defaultcontent_condition.inc on line 3

Boobaa’s picture

Sounds like defaultcontent.module depends on context.module, but it's not even listed as a dependency. Or something alike, didn't have the time to investigate further.

czigor’s picture

Priority: Major » Critical

The same here.

Bitbull’s picture

the unmentioned dependency could be the reason, I noticed some other dependencies that are not very well listed with the openenterprise installation. developers: please check this. thanks.

Bitbull’s picture

Indeed, after adding and enabling context module, problem seems to be solved. So, please specify dependancy in next module version. Thanks.

czigor’s picture

Status: Active » Needs review
FileSize
273 bytes

Patch attached.

rvilar’s picture

Status: Needs review » Needs work

This patch is for 2.x branch and this branch is, nowadays, in a heavy development process. Can you make this patch in 7.x-1.x branch?

czigor’s picture

Status: Needs work » Needs review
FileSize
262 bytes

Ah, sorry.

pcho’s picture

@Bitbull

Thank you for documenting and bringing this issue up to my attention. I was able to reproduce the bug mentioned in your opening post, and I have implemented a bug fix for this issue.

In response to the other contributors to this issue, adding the context dependency would not make sense in this case considering the feature in question is a plugin to the module and not a core feature. I have rather insured that the module is enabled prior to executing that portion of the module, so that everyone using defaultcontent is not forced into enabling an optional component.

Please review the latest push to the 7.x-1.x branch, and if no additional issues are reported, I will incorporate this into the next version.

sheena_d’s picture

I'm still experiencing this issue after using the 7.x-1.x-dev release from March 1, 2012. It seems that Drupal parses the defaultcontent_condition.inc file whether or not it is actually evoked in defaultcontent_condition.module. Wrapping the entirety of defaultcontent_condition.inc in if (module_exists('context')) {..} resolved the error message for me although that doesn't seem like a very elegant solution to the issue.

The best solution might be to wrap the Context plugin into a sub-module so that it can be enabled only by users who require the integration with Context.

randallknutson’s picture

Marked http://drupal.org/node/1471150 as duplicate

localizador1709’s picture

I am a curious mixture of anxiety, user and small developer.
I am studying to migrate Drupal sites built in Joomla.
I am still adapting to the differences in structure.
I really enjoyed the OpenEnterprise.
The lines of the patch context-dependency-1446714-8.patch must be inserted in defaultcontent.info?

Chris Kenny’s picture

@ localizador1709
The answer to your question is Yes. But If you read here: Patches It will explain just what the patch file does. You can manually edit the file to be patched or you can use a program called Git Making a Drupal patch with Git. For windows you can use Cygwin see How to apply a patch

In this case if you look at the patch file you will find that it only adds the text "dependencies[] = context" after the line that declares "dependencies[] = ctools."

Since this is only a single line edit it can be done rather simply in a text editor.

kclarkson’s picture

Please commit :O )

frankcarey’s picture

IMO - There shouldn't be a dependency on context. Here is a patch that adds a conditional to hook_node_view and moves the context plugin directory out of the ctools plugin directory to avoid it being loaded at the wrong time.

rvilar’s picture

It seems an interesting patch. I would check it later. Thanks a lot!

briand44’s picture

Patch in #15 seems to work for me. Thanks

frankcarey’s picture

Status: Needs review » Reviewed & tested by the community
markhalliwell’s picture

#15 works. Please commit AND release, this is a critical issue.

DrWang86’s picture

Please commit AND release.I don't know how to patch

mirzu’s picture

worked for me.

rvilar’s picture

Status: Reviewed & tested by the community » Fixed

Commited to 7.x-1.x branch

Status: Fixed » Closed (fixed)

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

mgifford’s picture

Any thoughts on the next release?

renenee’s picture

I loaded the dev branch and see the patch has been applied but am still getting the error. Anything I'm doing incorrectly?

gastons’s picture

Assigned: Unassigned » gastons
Status: Closed (fixed) » Needs review

Im having the same problem with 7.x-1.0-alpha6, the error says:

Fatal error: Class 'context_condition' not found in ...\profiles\opendeals\modules\defaultcontent\plugins\defaultcontent_condition.inc on line 3

Its the same error all around.

Any other suggestions?

Thanks!

gastons’s picture

Assigned: gastons » Unassigned

Im sorry for my mistake, back to "Unassigned" again.

(Sorry guys I'm newbie, didn't want to assing to myself this issue)

gastons’s picture

Status: Needs review » Reviewed & tested by the community

Well, well, well... I almost solved my problem, I installed the "Context" module that wasn't present before and for now I don't find any other "Fatal error" runing Cron or Modules Update, I just fill this in .info file:

name = Default Content
description = Allows Export/Import of Default Content
core = 7.x
package = Features
dependencies[] = features
dependencies[] = ctools
dependencies[] = context

Seems to be working alright just adding "context" as dependency.

Let me know if there another way to solve this or other bug walking around, LOL... ;)

markhalliwell’s picture

@gastons: Welcome! Thanks for also voicing your concern. This has indeed been a rather annoying and reoccurring issue for a lot of us. However in comment #15, the issue of dependency was already addressed and decided against. Instead an "if" clause was wrapped around the issues pertaining to context support, if it is actually installed and enabled. These changes were then committed to the dev branch in #22.

I strongly feel that this issue should not be "closed" until it is actually "fixed" in a stable release, which has been LONG overdue.

Jeffrey C.’s picture

Status: Reviewed & tested by the community » Active

@Mark Carver: Yep absolutely correct, same feeling here.
Setting the status back to active since this issue was not fixed AT ALL.

Jeffrey C.’s picture

To the maintainer: seeing that the last commit was 36 weeks ago AND this issue hasn't been fixed for around NINE months, I'm now reasonably doubting the maintenance status of this module. If no response was given, I will make a request to the Drupal.org webmasters queue for the maintainership for this module per http://drupal.org/node/251466.

Jeffrey C.’s picture

Jeffrey C.’s picture

Status: Active » Reviewed & tested by the community

I'll commit it ASAP.

Jeffrey C.’s picture

Version: 7.x-1.0-alpha6 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Ah, finally it's fixed! (defaultcontent 7.x-1.0-alpha7). Thanks again!

Status: Fixed » Closed (fixed)

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

yched’s picture

That sounds like a very hasty fix.

It seems there's no reason whatsoever to introduce a hard dependency on the context.module.
The defaultcontent_condition class only provides a functional enhancement *if* the context module is enabled, but is definitely not central to the functionality of defaultcontent - and while I want to run defaultcontent on one of my sites, I have zero use for context.module and am absolutely not interested in adding it.

The original patch form #15, that was committed in #22, seemed like the correct approach - progressive enhancement.
If people were still getting the "Fatal error: Class 'context_condition' not found in", that sounds strange (I didn't), but that seems to be what should investigated, rather than introducing the hard dependency.

Jeffrey C.’s picture

Assigned: Unassigned » Jeffrey C.
Status: Closed (fixed) » Reviewed & tested by the community

I apologize. Just took over this module from the previous maintainer and was absolutely in a hurry trying to fix this critical issue. I'll look over this ASAP and make it the next stable release.

markhalliwell’s picture

Status: Reviewed & tested by the community » Closed (fixed)

yched is correct, the fix was already committed to dev in #22 which simply added an if clause for context. There was no need to add dependency to context (introduced in commit: ff2fcfd) and should be removed.

markhalliwell’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Didn't mean to change status.

Jeffrey C.’s picture

I understand. Please allow a few day's time for me to fix it.

Jeffrey C.’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in commit 510f3b7. Sorry about the overdue.

markhalliwell’s picture

Status: Fixed » Reviewed & tested by the community

Sorry, that commit only added the LICENSE.txt file (which should never be added) and additional packaging information in the .info file (which also should never be added). You didn't actually remove the dependency.

Jeffrey C.’s picture

Status: Reviewed & tested by the community » Needs work

Oh my God that was completely horrible! Can anyone provide a patch against 7.x-1.0-alpha8? Including fix from #15?

markhalliwell’s picture

Status: Needs work » Needs review
FileSize
18.99 KB

Here ya go...

markhalliwell’s picture

Also, to reiterate, the patch in #15 was already committed by @rvilar in #22. My patch above just removes the mishaps made after the fact and will allow this issue to finally be closed once they are committed.

Jeffrey C.’s picture

Alright. Looking through the patch, will commit it ASAP. Sorry again for the trouble.

Jeffrey C.’s picture

Can anyone check if b1a5a8c fixes this issue?

markhalliwell’s picture

Status: Needs review » Reviewed & tested by the community

Patch was committed successfully. Just a passing note for applying patches, it's better to use git am instead of git apply. git am will parse additional meta data attached with the patch, ie: the author of the patch (so they get credit). I really didn't do anything in this issue, so I'm not saying I should get credit lol just for future patches where it does matter.

Jeffrey C.’s picture

Status: Reviewed & tested by the community » Fixed

Sure. Thanks a lot for your help :).

Status: Fixed » Closed (fixed)

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

JakeRogers’s picture

Are you guys Government workers? Issue fixed because no one spoke up? What do you expect after 50 posts echoing the same problem and NO ONE can offer a fix other than to delete the functionality of your database?
Forgive my cynicism but aren't these problems supposed to be solved rather than sweeping under the rug?
Disillusioned Jake

Jeffrey C.’s picture

@JakeRogers: Please mind your attitude. If you would pay JUST a little more attention to the comment stream you would see that this issue had already been resolved per #48, in commit b1a5a8c. Keep in mind that no one here is under the obligation to do anything for you. This is an open community, and it was not you that contributed the code. So please don't come demanding things just because you haven't yet figured out anything.

JakeRogers’s picture

I apologize for my ignorance, but I'm a newbie. I did study for days and made 2 new posts of my problem, but obviously did not understand above...looked at the License.txt and the code for defaultcontent.info. For the obvious reason, I am reluctant to start coding files that I know nothing about, especially when the solution is NOT CLEAR.
Is the solution to add the code in defaultcontent.info to the file causing the Fatal Error? i.e. defaultcontent_condition.inc. If so, does it matter where the code is placed in the file? If not, what is the solution? Thanks for any help and my only excuse for harshness is the frustration level...I do understand that everyone is giving their time and I appreciate that...perhaps just make it a bit clearer for us amateurs. Thanks,
Jake

Jeffrey C.’s picture

especially when the solution is NOT CLEAR

I'm afraid I have to say that you still figured nothing. I recommend you remedy that by starting to read some documentation. LICENSE.txt is automatically added to every project release by Drupal.org, and has nothing to do with the documentation. It's only a copy of the GPL license. As shown very clearly on the project page, this bug has been fixed in release 7.x-1.0-alpha9. So if you had used that release, you won't have encountered this problem. You're not supposed to mess with the code, you should just use 7.x-1.0-alpha9.

JakeRogers’s picture

Perhaps we can both learn something here...I had already downloaded and installed 7.x1.0-alpha9 and the error persists...thus the frustration at lack of a solution, at least for me. To reiterate my error occurs when running Cron and is:
Fatal error: Cannot redeclare class defaultcontent_condition in /home/jcrogers/public_html/modules/defaultcontent/plugins/defaultcontent_condition.inc on line 57. I also notice this error shows up at the bottom of some browsers (Mozilla and IE) when loading the site, but NOT Google. I only noticed it after I went to run Cron manually and it popped up after running and last run date did not change.
Any other ideas???

Jeffrey C.’s picture

JakeRogers’s picture

Sorry but same audience and ignorance there!

JakeRogers’s picture

Well Jeff, my site is now totally fubar, thanks to all these ambiguous solutions to a problem that I wish I had IGNORED! Way too many cooks in the kitchen here!!!!!!!!!!!!!!

Jeffrey C.’s picture

Please don't demand anything since you paid/contributed nothing. Again, it was not you but someone else that wrote the code, you can of course not use this project. Most users here, like me, have a job and can't work full-time on this. We can only develop/maintain the module during our free time. Since someone else already posted the issue, please wait while someone can provide a patch to the bug.

markhalliwell’s picture

Well Jeff, my site is now totally fubar, thanks to all these ambiguous solutions to a problem that I wish I had IGNORED! Way too many cooks in the kitchen here!!!!!!!!!!!!!!

@JakeRogers: Please read Drupal Code of Conduct. Everything you are saying is inaccurate and inappropriate. Your "fubar"-ed site is the result of an unrealized and obviously non-implemented workflow (your fault). You should really make backups before ever dealing with any open source software, I mean seriously. Also, "ambiguous solutions", really? Please read an issue before complaining about something that has obviously already been addressed and fixed:

  • #15 - The original issue was patched.
  • #22 - The original issue was committed.
  • The reset of the issue was in regards to the lack of support of this module and fixing a minor issue with the .info file still containing a dependency on context.
  • #48, #49 - There were a few mishaps with some commits, but those were ultimately resolved.
  • #50 - This issue was finally closed.

Most of us on d.o also have full time jobs and only work on these things when time permits. This is open source buddy, we don't work for you. Before complaining, read and search for existing issues, submit a patch when you find a problem and ultimately HELP those who are trying to maintain modules instead of just adding more convoluted noise to the issue queues.

You're a 47 week user who hasn't contributed anything back to Drupal. I suggest you work on that since many of us use this to determine the learn curve of a user and whether a user is there to help or just complain.

I know getting involved with d.o can be a daunting task (believe me), but we simply ask that you do it with a little more respect.

JakeRogers’s picture

Respectfully, I now have my site restored and am back where I started. For the record...I would love to contribute and will do so when I have learned enough to help others, rather than confuse and offer poorly conceived solutions that do nothing more than compound a problem...that's what I have run across here with this latest problem. Having complained, I must also note that I have also received much help here in developing a site from scratch and I AGAIN thank those for their help!

Starting anew...I can't run Cron because I get : Fatal error: Cannot redeclare class defaultcontent_condition in /home/jcrogers/public_html/modules/defaultcontent/plugins/defaultcontent_condition.inc on line 57

What do you suggest I do to begin to troubleshoot this problem?
To reiterate: I have already installed the above patch, which did not work for me!
I also installed a module call Group Deals that I was somehow led to as a solution...it did indeed solve the above error, but created MANY, MANY more, which ultimately led to a disfunctional site.
I have now restored my site and am back to where I began with the above Fatal error!

Any definitive information or reference is much appreciated...
What I don't understand is IF this is an acknowledged problem?
Is it being worked?
Can I track, help, or otherwise be part of a solution?
...I feel as if I'm going in circles here and everywhere I turn, someone professes to know the way out of the woods, but points in a different direction.

Thanks for any HELP.
Jake

markhalliwell’s picture

I posted my the response to the error you seem to be having over at #1956534-5: Fatal error due to conflict with other contributed modules.

On a side note:

rather than confuse and offer poorly conceived solutions that do nothing more than compound a problem

We love ideas, whether they are the right ones or not. We cannot begin to solve a problem until we understand what the actual issue is. Sometimes that does take a quite a few comments back and forth of ideas, not solutions (take #696: Add filter to logs and referrer lists which has been open for over 10 years). I can guarantee you that you would find less resistance and more help if you post in issues as one who is trying to help the issue instead of just complaining about it:

#51 - Are you guys Government workers? Issue fixed because no one spoke up? What do you expect after 50 posts echoing the same problem and NO ONE can offer a fix other than to delete the functionality of your database?
Forgive my cynicism but aren't these problems supposed to be solved rather than sweeping under the rug?
Disillusioned Jake

You made this insulting comment 3 days before even finding and commenting on #1956534: Fatal error due to conflict with other contributed modules (which is really the problem you seem to be having, not this one). There was no context in what issue you were having, just your sudden comment about something getting "fixed" because we wanted to sweep what under the rug???

To reiterate: I have already installed the above patch, which did not work for me!

Of course the "patch" for this issue won't work. It's for this issue, not the one your having. Not to mention this issue has been committed to the repo, so if the version of this module you installed is 7.x-1.0-alpha9 or 7.x-1.x-dev then the "patch" would already be in the code.

All in all, we really do appreciate your help in attempting to become more involved. And I know these "protocols" may seem a little foreign and overbearing at times, but just understand they help us all be a little more productive and pleasant when all we really want to do is pull our hair out ;) So believe me I understand your frustration.... really I do. Just when coming to us for help, please do it with a little more tact and understand that we really are here to help :)

Jeffrey C.’s picture

@Mark Carver: Thanks a lot for explaining everything. :)

JakeRogers’s picture

Whatever....here's the solution thanks to donpwinston's help with diagnosing:
Fatal error: Cannot redeclare class defaultcontent_condition in /home/jcrogers/public_html/modules/defaultcontent/plugins/defaultcontent_condition.inc on line 57

Finally, after 3+ weeks. I discover I have 2 copies of defaultcontent_condition.inc located in
1) modules/defaultcontent/plugins
and
2) modules/defaultcontent/context/plugins

Like don, I deleted the one in 1) above and cron runs fine...no more fatal errors...no errors finding usernames!!
Thank you donpwinston for the help..

markhalliwell’s picture

You don't have to post into issues with a completely unrelated please stop posting in this issue.

JakeRogers’s picture

I want others who may have the same problem as I to find a solution, rather than muddling the quagmire!
Respectfully,
Jake

JakeRogers’s picture

Issue summary: View changes

More detailed problem description, added the fact that problem is present on all installations.