From 80a48115395b599198725d6d9eb64116d9780ef6 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Fri, 17 Jul 2020 20:50:16 +0100 Subject: [PATCH] [ExtendedProfile] Fix misuse of XMLOutputter Argument 1 passed to xmloutputter::text() must be of the type string, null given, called in /srv/gnusocial/plugins/ExtendedProfile/lib/extendedprofilewidget.php on line 556 --- plugins/ExtendedProfile/lib/extendedprofile.php | 6 +++--- plugins/ExtendedProfile/lib/extendedprofilewidget.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/ExtendedProfile/lib/extendedprofile.php b/plugins/ExtendedProfile/lib/extendedprofile.php index 22ad590779..288cd62a52 100644 --- a/plugins/ExtendedProfile/lib/extendedprofile.php +++ b/plugins/ExtendedProfile/lib/extendedprofile.php @@ -84,12 +84,12 @@ class ExtendedProfile * @param string $name name of the detail field to get the * value from * - * @return string the value + * @return string|null the value, null if none */ - public function getTextValue($name) + public function getTextValue($name): ?string { $key = strtolower($name); - $profileFields = array('fullname', 'location', 'bio'); + $profileFields = ['fullname', 'location', 'bio']; if (in_array($key, $profileFields)) { return $this->profile->$name; diff --git a/plugins/ExtendedProfile/lib/extendedprofilewidget.php b/plugins/ExtendedProfile/lib/extendedprofilewidget.php index 17254951b2..cc99cbd076 100644 --- a/plugins/ExtendedProfile/lib/extendedprofilewidget.php +++ b/plugins/ExtendedProfile/lib/extendedprofilewidget.php @@ -553,7 +553,7 @@ class ExtendedProfileWidget extends Form case 'text': case 'textarea': case 'person': - $this->out->text($this->ext->getTextValue($name)); + $this->out->text($this->ext->getTextValue($name) ?? ''); break; case 'custom-text': case 'custom-textarea':