From 0c13153d8e9c4e63ee781a1a3ed4ef5050e199b2 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Terlizzi Date: Thu, 26 Mar 2015 17:27:31 +0100 Subject: [PATCH] Fix PHP Warning when "contributor" is NULL --- action.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/action.php b/action.php index 74e9a43..b74db1f 100644 --- a/action.php +++ b/action.php @@ -99,14 +99,16 @@ class action_plugin_semantic extends DokuWiki_Action_Plugin { 'email' => $user_data['mail'] ); - foreach ($meta['contributor'] as $uid => $fullname) { - $contributor_data = $auth->getUserData($uid); - $json_ld['contributor'][] = array( - '@context' => 'http://schema.org', - '@type' => 'Person', - 'name' => $fullname, - 'email' => $contributor_data['mail'] - ); + if (isset($meta['contributor'])) { + foreach ($meta['contributor'] as $uid => $fullname) { + $contributor_data = $auth->getUserData($uid); + $json_ld['contributor'][] = array( + '@context' => 'http://schema.org', + '@type' => 'Person', + 'name' => $fullname, + 'email' => $contributor_data['mail'] + ); + } } }