diff --git a/og.test b/og.test
index b0f38fb7f56a2da1cf3613cf0ba5f32cbbfaa53a..dd07a0f7498ab19506cd1efb7f9ed665f20a11ad 100644
--- a/og.test
+++ b/og.test
@@ -2166,7 +2166,10 @@ class OgNonMembersPublishingContentTestCase extends DrupalWebTestCase {
 
     $this->assertTrue(!empty($result['node']), 'The node was added to the group.');
 
-    $nid = reset(array_keys($result['node']));
+    // Avoid strict errors in php 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, see https://drupal.org/node/3000030 patch 2.
+    $result_node = $result['node'];
+    $node_array_keys = array_keys($result_node);
+    $nid = reset($node_array_keys);
 
     $this->drupalLogin($this->adminUser);