Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I receive an HTTP 500 error and the following error in the Apache error.log when attempting to install Open Atrium on Ubuntu 16 with PHP version 7.0.4:
PHP Fatal error: 'break' not in the 'loop' or 'switch' context in /mypath/profiles/openatrium/modules/contrib/og_vocab/og_vocab.module on line 259
From what I understand, in PHP 7.0 and higher, a break statement is no longer permitted outside a for, foreach or switch statement.
Here's the bit of code from og_vocab.module:
function og_vocab_uri($og_vocab) {
$url = array();
$vocab = taxonomy_vocabulary_load($og_vocab->vid);
if (user_access('administer taxonomy')) {
// URL to taxonomy administration.
$url = array(
'path' => "admin/structure/taxonomy/$vocab->machine_name/edit",
);
}
else {
$relation = og_vocab_relation_owner_get($og_vocab->vid);
if (og_user_access($relation->group_type, $relation->gid, 'administer t axonomy')) {
// URL to taxonomy administration in the group context.
$url = array(
'path' => "group/$relation->group_type/$relation->gid/admin/taxonom y/$vocab->machine_name/edit",
);
break; // Line 259
}
}
<< snip >>
Hope this helps.
Comments
Comment #2
3rik5 CreditAttribution: 3rik5 commentedDang, never mind! I was looking at an old version of og_vocab.
Comment #3
ultimikeHmm - "old version"? As far as I can tell this is still an issue in 7.x-1.2, and a dealbreaker for using this module with PHP7.
Looking at the code, it seems correct to just remove the "break", correct? In PHP < 7, don't breaks only work on loop structures only?
-mike
Comment #4
Tess BakkerSee #2039009-29: Allow sharing vocabularies between groups for more information about this issue.