This question about Not sure...: Asked

Error in userExists if $this->{session}->{user} doesn't exist

I am getting an error every time the mailnotify script is run by cron. The script is being called with:
cd /var/lib/foswiki && perl -I bin tools/mailnotify -q

The error I see is:
Use of uninitialized value in string eq at /var/lib/foswiki/lib/Foswiki/Users/TopicUserMapping.pm line 574, <DATA> line 751.

Looking at the source code of userExists in TopicUserMapping.pm the problem is that $this->{session}->{user} is being used when {user} doesn't exist. I have fixed the error with this before it is used:
    # protect against user not existing
    return 0 if !exists $this->{session}->{user};

Is this a valid fix for the problem or is there soemthing more fundamental going wrong that means {user} is not set?

-- WillWagner - 21 Jul 2016

I also get this error:

view: Use of uninitialized value in string eq at /var/www/foswiki/lib/Foswiki/Users/TopicUserMapping.pm line 574. a few times in my error_log I don't know what is causing them

-- CobraKoral - 10 Feb 2017

I'm not sure how this ends up uninitialized. Foswiki.pm is responsible for establishing the user identity, and it appears that it should default to the configured $Foswiki::cfg{DefaultUserLogin} if no user is available. The patch suggested above seems reasonable, but we'd really need some deeper debugging to figure this one out.

I've never observed this on any of my test systems, or on foswiki.org.

-- GeorgeClark - 10 Feb 2017
 

QuestionForm edit

Subject Not sure...
Extension TopicUserMappingContrib
Version Foswiki 2.1.2
Status Asked
Related Topics
Topic revision: r3 - 10 Feb 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy