Sympa::Scenario::new() was unable to load scenario filename including dots
Created by: salaun-urennes1
We are upgrading from Sympa 6.2.36 to 6.2.42. After upgrading our test staging instance of Sympa we encountered an error while editing the liste config through the web interface:
DIED: Can't call method "get_current_title" on unblessed reference at /usr/local/sympa/bin/wwsympa.fcgi line 10847.
at /usr/local/sympa/bin/wwsympa.fcgi line 10847.
main::_do_edit_list_request(Sympa::List::Config <test-sympa-2-2-42@listes.univ-rennes1.fr>, HASH(0x59b0758), ARRAY(0x5bbf7e0)) called at /usr/local/sympa/bin/wwsympa.fcgi line 10771
main::do_edit_list_request() called at /usr/local/sympa/bin/wwsympa.fcgi line 1558
The log says:
Apr 8 10:35:40 vmperl-tsympa1 wwsympa[10736]: info main::do_edit_list_request(description) [robot listes.univ-rennes1.fr] [session 50683453466904] [client 129.20.126.26] [user odile.germes@univ-rennes1.fr] [list test-sympa-2-2-42]
Apr 8 10:35:40 vmperl-tsympa1 wwsympa[10736]: err main::#1558 > main::do_edit_list_request#10771 > main::_do_edit_list_request#10842 > Sympa::Scenario::get_scenarios#1617 > Sympa::Scenario::new#156 Unknown or undefined scenario function "visibility"
Apr 8 10:35:40 vmperl-tsympa1 wwsympa[10736]: err main::#1558 > main::do_edit_list_request#10771 > main::_do_edit_list_request#10842 > Sympa::Scenario::get_scenarios#1617 > Sympa::Scenario::new#156 Unknown or undefined scenario function "visibility"
Apr 8 10:35:40 vmperl-tsympa1 wwsympa[10736]: err main::#1558 > main::do_edit_list_request#10771 > main::_do_edit_list_request#10847 DIED: Can't call method "get_current_title" on unblessed reference at /usr/local/sympa/bin/wwsympa.fcgi line 10847.
Here is what happens:
-
Sympa::Scenario->new()
fails to load a scenario namedvisibility.igr.univ-rennes1.fr
because only/\A[-\w]+\z/
if allowed for the scenario name, -
Sympa::Scenario::get_scenarios()
returns an array with some undefined values, -
wwsympa::_do_edit_list_request()
fails to interpret$_->get_current_title
because$_
is undefined.
The bug was introduced in https://github.com/sympa-community/sympa/commit/c8aca8379294c9bfce724e4f73a7c984d6f085c0
The pull request fixes (1):
- allowing dots in scenario names,
- providing more details in the error log,
- preventing undefined entries to be returned by
Sympa::Scenario->new()
.
It would also make sense to:
- consolidate
wwsympa::_do_edit_list_request()
in caseSympa::Scenario::get_scenarios()
returns undefined values. - add parenthesis to this condition https://github.com/sympa-community/sympa/blob/sympa-6.2/src/lib/Sympa/Scenario.pm#L153