Tags:
create new tag
view all tags

Bug: Uninitialized Value In Mailnotify With Empty WebNotify

There is an uninitialized value bug in the 20010901 version of mailnotify triggered by having no addresses listed in the WebNotify topic of a web.

Test case

  • Delete all addresses from the Test WEb topic.
  • Run mailnotify as per the crontab command and you will get output similar to:

Checking TWiki.Test
- Changed topics since 03 Nov 2001 - 22:13: WebNotify 
Use of uninitialized value at ./mailnotify line 160.
- Sending mail notification to: 
* ERROR: Can't send mail, missing receipient
- End Twiki.Test

The bug is in how mailnotify handles the return value of &TWiki::getEmailNotifyList when there are no addresses in the WebNotify topic. &TWiki::getEmailNotifyList returns either the list of addresses or an array with one 'undef' entry. Mailnotify checks length of the array and does not send email if the array is empty.

The following patch to TWiki.pm fixes this bug:

--- TWiki.pm.back       Sat Nov 10 15:57:14 2001
+++ TWiki.pm    Sat Nov 10 16:14:32 2001
@@ -330,7 +330,7 @@
        push @list, $1 if (/([\w\-\.\+]+\@[\w\-\.\+]+)/);
     }
 
-    return (scalar @list ? @list : undef);    
+    return (@list);    
 }
 
 # =========================

-- LanceABrown - 10 Nov 2001

Fix record

What a coincidence, I just fixed that this morning! Is in TWikiAlphaRelease.

-- PeterThoeny - 10 Nov 2001

Environment

TWiki version: 20010901
TWiki plugins: Defaults
Server OS: Red Hat Linux 6.1 w/ linux 2.2.12-20
Web server: Apache 1.3.19
Perl version: 5.005
Client OS: Linux
Web Browser: Mozilla 0.9.5

-- LanceABrown - 10 Nov 2001

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2001-11-11 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.