From a8d9747b1298e7c1f595335a4c2fe16b028cc858 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 20 May 2026 05:49:33 +0000 Subject: [PATCH] test variable before using it (cherry picked from commit 82b8ed265280bc96c7f6b73ae5ee55f821a3b215) Co-authored-by: Mario --- Zotlabs/Module/New_channel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 48fcd9e10..340173f02 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -33,7 +33,7 @@ class New_channel extends \Zotlabs\Web\Controller { // first name if(strpos($x,' ')) $test[] = legal_webbie(substr($x,0,strpos($x,' '))); - if($test[0]) { + if (!empty($test[0])) { // first name plus first initial of last $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : ''); // first name plus random number @@ -69,7 +69,7 @@ class New_channel extends \Zotlabs\Web\Controller { // first name if(strpos($x,' ')) $test[] = legal_webbie(substr($x,0,strpos($x,' '))); - if($test[0]) { + if (!empty($test[0])) { // first name plus first initial of last $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : ''); // first name plus random number