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