Parse error: syntax error, unexpected ''login_submitted''

Bug #1636854 reported by Kevin Rickis on 2016-10-26
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
High
Robert Lyon
16.10
High
Unassigned

Bug Description

Hi

I'm trying a clean install of Mahara 16.10.0 on a server running PHP 5.4 and I'm getting this error.

Parse error: syntax error, unexpected ''login_submitted'' (T_CONSTANT_ENCAPSED_STRING) in /mnt/data1/www/m1610.edictdev.co.uk/httpdocs/auth/lib.php on line 1443

Looking at the code I think there might have been a copy and paste error as you cannot check for empty('login_submitted'). My guess is that it should be $values?

Function below.

Kevin

/**
 * Called when the login form is being validated during submission.
 * Checks the user and password fields are filled in.
 *
 * @param object $form The Pieform form object
 * @param array $values The submitted values
 */
function login_validate(Pieform $form, $values) {
    if (!empty('login_submitted')) {
        if (empty($values['login_username']) || empty($values['login_password'])) {
            $form->set_error(null, get_string('loginfailed'));
        }
    }
}

Kevin Rickis (rdx565) on 2016-10-26
description: updated
Robert Lyon (robertl-9) on 2016-10-26
Changed in mahara:
importance: Undecided → Medium
importance: Medium → High
assignee: nobody → Robert Lyon (robertl-9)
milestone: none → 17.04.0
status: New → In Progress

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

commit 173cb08db51aa8cf982f864e3d6c1c090bad958e
Author: Robert Lyon <email address hidden>
Date: Thu Oct 27 08:33:03 2016 +1300

Bug 1636854: unexpected T_CONSTANT in login_validate()

Needed to be $values['login_submitted']

behatnotneeded

Change-Id: I1115c7cd90e7d28003c579004f4c7f9281000b4e
Signed-off-by: Robert Lyon <email address hidden>

Reviewed: https://reviews.mahara.org/7222
Committed: https://git.mahara.org/mahara/mahara/commit/9eac27c1d61d18c6f2ec97c44bef87a65db3cdcb
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.10_STABLE

commit 9eac27c1d61d18c6f2ec97c44bef87a65db3cdcb
Author: Robert Lyon <email address hidden>
Date: Thu Oct 27 08:33:03 2016 +1300

Bug 1636854: unexpected T_CONSTANT in login_validate()

Needed to be $values['login_submitted']

behatnotneeded

Change-Id: I1115c7cd90e7d28003c579004f4c7f9281000b4e
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 173cb08db51aa8cf982f864e3d6c1c090bad958e)

Robert Lyon (robertl-9) on 2016-11-01
Changed in mahara:
status: In Progress → Fix Committed
Juan Menéndez (juan-menendez) wrote :

I had the same error and I applied these changes but now the error is different:

Fatal error: Can't use function return value in write context in /mahara/auth/saml/lib.php on line 453

Robert Lyon (robertl-9) wrote :

Hi Juan,

The error you describe looks to be this issue:
https://bugs.launchpad.net/mahara/+bug/1636866

That has been fixed by this patch:
https://reviews.mahara.org/#/c/7213/1

Please try that patch to see if it fixes your issue

Cheers

Robert

Juan Menéndez (juan-menendez) wrote :

OK, now works correctly
Thank you!

Robert Lyon (robertl-9) on 2017-04-27
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers