"$cfg->urlsecret = null;" doesn't work during installation

Bug #1595789 reported by Aaron Wells on 2016-06-24
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Aaron Wells
16.04
Medium
Aaron Wells
16.10
Medium
Aaron Wells

Bug Description

According to config-defaults.php, if you set $CFG->urlsecret to null, you should be able to access the installer and upgrader without needing to add a urlsecret param to your URL. This is a useful feature for development environments.

However, it currently doesn't work on the latest HEAD in master.

To replicate:

1. Add "$cfg->urlsecret = null;" to your config.php file
2. Try to do a new install of Mahara through the web browser

Expected result: Installation runs through
Actual result: You get this message:

Mahara: Invalid Parameter
A required parameter is missing or malformed

The 'urlsecret' parameter contains invalid characters

Aaron Wells (u-aaronw) wrote :

Testing indicates this is a problem during installation, but not during upgrades.

summary: - "$cfg->urlsecret = null;" no longer works
+ "$cfg->urlsecret = null;" doesn't work during installation
Aaron Wells (u-aaronw) wrote :

Hm, interesting, it also works fine if you go directly to $wwwroot/admin/upgrade.php. It only breaks if you start at $wwwroot/, and click the "Install Mahara" button.

Aaron Wells (u-aaronw) wrote :
tags: added: regression
Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/6621

Reviewed: https://reviews.mahara.org/6621
Committed: https://git.mahara.org/mahara/mahara/commit/31ab623ec65e68b81bfa357c3879dabc86dc803b
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 31ab623ec65e68b81bfa357c3879dabc86dc803b
Author: Aaron Wells <email address hidden>
Date: Fri Jun 24 15:42:00 2016 +1200

Bug 1595789: More prominent documentation of urlsecret.

Change-Id: I293c5ac256b2325327eb934205ff334c8c596879
behatnotneeded: Documentation only

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6620
Committed: https://git.mahara.org/mahara/mahara/commit/a334a69e96810dee124bb8a2a19746a59f3cf3a2
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit a334a69e96810dee124bb8a2a19746a59f3cf3a2
Author: Aaron Wells <email address hidden>
Date: Fri Jun 24 15:15:48 2016 +1200

Bug 1595789: Make NULL urlsecret work during installation

It was failing because we'd set the default value on
param_alphanumext() to "null". But if the default passed
to that function evaluates to false (as null does), then
the function acts as if you've passed no default, and
hence it's a required function.

Further, the template form where we add the urlsecret
to the install button, in case of a null urlsecret,
would wind up adding "urlsecret=" to the end of the
URL. param_alphanumext() would see the presence of
the "urlsecret" query parameter, so it would evaluate
this to match its regex, which requires there to be
at least one character in the value. And then that
would throw a "ParameterException" when the check failed.

Change-Id: I1fb4ed7bcfe14155532e4ebb5d8c0dbdc33d1d36
behatnotneeded: Can't yet test in behat

Mahara Bot (dev-mahara) wrote :

Patch for "16.04_STABLE" branch: https://reviews.mahara.org/6630

LIsa (lisadunmire) wrote :

Performed the following steps for testing:

Pre requisite: $cfg->urlsecret = null;

1. Create Mahara dbase from command line
2. From Mahara link, click on install

Expected result: "The 'urlsecret' parameter contains invalid characters" message displayed

3. Pull the patch (status 16.04_STABLE)
4. Refresh the Mahara link>click on Mahara
5. Click on install
6. Install is succesful

Reviewed: https://reviews.mahara.org/6629
Committed: https://git.mahara.org/mahara/mahara/commit/0b5a06064f42207f903abe411cd0710fbb31b0e8
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit 0b5a06064f42207f903abe411cd0710fbb31b0e8
Author: Aaron Wells <email address hidden>
Date: Fri Jun 24 15:15:48 2016 +1200

Bug 1595789: Make NULL urlsecret work during installation

It was failing because we'd set the default value on
param_alphanumext() to "null". But if the default passed
to that function evaluates to false (as null does), then
the function acts as if you've passed no default, and
hence it's a required function.

Further, the template form where we add the urlsecret
to the install button, in case of a null urlsecret,
would wind up adding "urlsecret=" to the end of the
URL. param_alphanumext() would see the presence of
the "urlsecret" query parameter, so it would evaluate
this to match its regex, which requires there to be
at least one character in the value. And then that
would throw a "ParameterException" when the check failed.

Change-Id: I1fb4ed7bcfe14155532e4ebb5d8c0dbdc33d1d36
behatnotneeded: Can't yet test in behat
(cherry picked from commit a334a69e96810dee124bb8a2a19746a59f3cf3a2)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6630
Committed: https://git.mahara.org/mahara/mahara/commit/1460caad2d641bb2847c467ce9347943afd413f3
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit 1460caad2d641bb2847c467ce9347943afd413f3
Author: Aaron Wells <email address hidden>
Date: Fri Jun 24 15:42:00 2016 +1200

Bug 1595789: More prominent documentation of urlsecret.

Change-Id: I293c5ac256b2325327eb934205ff334c8c596879
behatnotneeded: Documentation only
(cherry picked from commit 31ab623ec65e68b81bfa357c3879dabc86dc803b)

Robert Lyon (robertl-9) on 2016-10-21
Changed in mahara:
milestone: 16.10.0 → none
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers