Here is my error message when enabling flag module :

Fatal error: Unsupported operand types in /home/drupal/drupal/sites/all/modules/flag/flag.inc on line 950

Thx for your work

Comments

Grayside’s picture

I found this problem under PHP 5.3 with Zen interacting with the core url() function. In that case, moving the first array element to the same line as the array declaration seemed to fix it.

In other words,

  function get_views_info() {
    return array(
      'views table' => 'node',

Becomes

  function get_views_info() {
    return array( 'views table' => 'node',
amitaibu’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new2.17 KB

The problem was that we tried to create a flag on hook_install, but flag's hook implementation were not used as module wasn't considred enabled.
Patch moves the flag creation to hook_enable().

quicksketch’s picture

I don't think using hook_enable() is a good way of handling this, as it will cause Flag to re-create a bookmark flag every time the module is enabled. Or worse yet, this would actually *overwrite* existing settings that a user had made to the bookmark flag.

Amitaibu, could you clarify what you mean by "flag's hook implementation were not used"? Does Flag need to have some hooks firing during install?

amitaibu’s picture

+++ flag.install	15 Oct 2009 08:22:13 -0000
@@ -7,24 +7,17 @@
+  if (!flag_get_flag('bookmarks')) {

We won't create another flag, as we have this check.

> Does Flag need to have some hooks firing during install?

Yes - The problem is that module_invoke_all('flag_link_types') doesn't find flag_flag_link_types().

This review is powered by Dreditor.

quicksketch’s picture

We won't create another flag, as we have this check.

Ah, but the problem still exists if the user deleted that flag, it will be re-created by enabling/disabling the module. :-/ Let's use a count(flag_get_flags()) instead, so that if there are *any* flags, we won't recreate the bookmarks flag.

amitaibu’s picture

Status: Needs review » Needs work

sounds ok. I'm without dev enviroment (it's the weekend after all) so I won't get to it untill next week.

amitaibu’s picture

Status: Needs work » Needs review
StatusFileSize
new2.35 KB

Patch uses flag_get_flags().

quicksketch’s picture

Status: Needs review » Fixed

Committed. Thanks again Amitaibu!

Status: Fixed » Closed (fixed)

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