Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Run drush dis module_name --debug and I get the following error:
PHP Fatal error: Unsupported operand types in modules/all/og/includes/og.info.inc on line 29
Drush command terminated abnormally due to an unrecoverable error. [
Error: Unsupported operand types in /var/aegir/platforms/7/modules/all/og/includes/og.info.inc,
$properties['entity_type'] += array(
'required' => TRUE,
'options list' => 'og_get_all_group_entity',
);
Comment | File | Size | Author |
---|---|---|---|
#11 | og-fatal_in_og.info_.inc-1543696-11.patch | 1.04 KB | Nephele |
#7 | og-fatal_in_og.info_.inc-1543696-7.patch | 1.11 KB | Nephele |
#5 | og-fatal_in_og.info_.inc-1543696.patch | 1.29 KB | Nephele |
Comments
Comment #1
wielrijder CreditAttribution: wielrijder commentedsame error. site locked up
Comment #2
shenzhuxi CreditAttribution: shenzhuxi commentedConfirm for
7.x-1.4
7.x-1.x-dev
7.x-2.x-dev
Comment #3
nikolas.tatianenko CreditAttribution: nikolas.tatianenko commentedAdding test for array on line 29 and 109 will solve problem
for example i'll make changes in line 29
text on this line
$properties['entity_type'] += array(
'required' => TRUE,
'options list' => 'og_get_all_group_entity',
);
i'll change to
if (is_array($properties['entity_type'])){
$properties['entity_type'] += array(
'required' => TRUE,
'options list' => 'og_get_all_group_entity',
);
}
the same on 109 line
Comment #4
Nephele CreditAttribution: Nephele commentedI'm getting this same problem when trying to update from an early 1.x-dev release of og (Mar 6, 2011) to og 1.4. The version of og that I'm starting from is old enough that the og_membership table did not previously exist.
The problem is triggering for me on line 113 of og.info.inc in og 1.4. It occurs when I try to run update.php -- and once it's triggered within update.php, trying to load any page on the site produces the same error message and aborts. I'm simultaneously updating og, entity, and entityreference; entity is being updated from version 7.x-1.0-beta7 to 7.x-1.0-rc3. (And note that entity 1.0-beta7 is the last version that is still compatible with the old version of og I'm using, so I have to install and update both modules simultaneously).
I've traced the problem to the fact that entity.info.inc tries to look up the og_membership schema (using
drupal_get_schema('og_membership')
in its entity_metadata_convert_schema function), it's coming back empty ($schema = FALSE
). When I look in mysql, the og_membership table does exist, but it has not been added to the cached version of the schema being checked by drupal_get_schema.I was able to resolve the issue by editing entity.info.inc, changing line 149 to
drupal_get_schema('og_membership', TRUE)
-- forcing drupal to rebuild its schema instead of using the cached version.So basically I'm guessing it's a transient problem that can crop up if both entity and og need to be updated simultaneously -- entity is asked to run its update functions before any of og's update functions have been called, forcing entity to try to generate entity definitions with incomplete information. As such, the real root of the problem is probably with entity (therefore I've added a bug report at entity, see #1748626: entity_metadata_convert_schema can try to use out-of-date schema information).
However, it may also be prudent to have some code added to og.info.inc to ensure that its functions quit somewhat more gracefully if parent::entityPropertyInfo() returns invalid/unexpected information -- allowing entity to successfully finish its updates and then give og a chance to properly run its update functions.
Comment #5
Nephele CreditAttribution: Nephele commentedI subsequently noticed that this issue has effectively been patched in og 7.x-2.0-beta1, so I copied the same code into 7.x-1.x-dev and created the attached patch.
Comment #7
Nephele CreditAttribution: Nephele commentedRetrying the same patch, but without some unnecessary array keys.
Comment #9
Nephele CreditAttribution: Nephele commented#7: og-fatal_in_og.info_.inc-1543696-7.patch queued for re-testing.
Comment #10
amitaibuMinor:
Better short it to just
Initialize values.
Is this really needed, as in next line we assign the values.
Comment #11
Nephele CreditAttribution: Nephele commentedRe:
The next line assigns $properties['entity'], not $properties['entity_type']. When entity_type is modified, it's using +=, not =:
Which is precisely what causes the unsupported operand types error (can't add a scalar and an array) unless entity_type has been initialized.
Comment #12
amitaibuCommitted, thanks.