Review main Merged

27126[BUGFIX] Various PHP Warnings with invalid credentials

Xavier Perseguers CR +2 V +2 Easy +7 −7 updated 02/03/14, 03:41

Commit message

When invalid credentials are entered in the Backend login form, various
PHP warnings are raised such as

    PHP Warning: Illegal string offset 'uid'

because $user is not an array.

Review

  • Code review CR +2
    • Stefan Neufeind +2
  • Verified V +2
    • Stefan Neufeind +2

Issues 1

Files 2

Review log 26

Show 1 earlier messages
  1. Georg Ringer voted on patch set 1 V +1 CR +1 01/29/14, 14:03

  1. Mr. Jenkins commented on patch set 1 01/29/14, 14:09

  2. Wouter Wolters voted on patch set 1 CR +1 01/29/14, 14:17

  3. Marcin Sągol commented on patch set 1 01/29/14, 14:44

    LoginController.php:183

    For each check: is_array($GLOBALS['BE_USER']->user) && $GLOBALS['BE_USER']->user['uid'] can't we just use isset($GLOBALS['BE_USER']->user['uid']) ?
  4. Markus Klein commented on patch set 1 01/29/14, 14:58

    I'd opt to change to isset() which is faster than is_array()

    LoginController.php:183 Reply

    Yes that should work!
  5. Xavier Perseguers commented on patch set 1 01/29/14, 15:14

    LoginController.php:183 Reply

    isset just checks the existance of the key, not that it's different from 0, so if we change we should change for empty() instead
  6. Markus Klein commented on patch set 1 01/29/14, 15:29

    LoginController.php:183 Reply

    yes I thought about isset($var) && $var which is of course empty($var). uid=0 is invalid anyway so empty is fine. +1
  7. Marcin Sągol commented on patch set 1 01/29/14, 15:36

    LoginController.php:183 Reply

    Agree. +1
  8. Xavier Perseguers uploaded patch set 2 02/01/14, 16:39

  9. Marcin Sągol commented on patch set 2 02/01/14, 16:47

    LoginController.php:183

    Maybe replace != with !== ?
  10. Xavier Perseguers commented on patch set 2 02/01/14, 16:51

    LoginController.php:183 Reply

    feel free
  11. Mr. Jenkins commented on patch set 2 02/01/14, 16:54

  12. Marcin Sągol uploaded patch set 3 02/01/14, 17:08

  13. Marcin Sągol commented on patch set 3 02/01/14, 17:12

    Just a small comparison operator change.
  14. Mr. Jenkins commented on patch set 3 02/01/14, 17:24

  15. Markus Klein voted on patch set 3 CR +1 02/01/14, 19:43

  16. Stefan Neufeind commented on patch set 3 V +1 CR +1 02/01/14, 20:11

    imho also 6.1
  17. Oliver Klee voted on patch set 3 CR +1 02/02/14, 13:37

  18. Stefano Kowalke commented on patch set 3 02/02/14, 17:31

    I can't reproduce this error. Entered 1) wrong username and correct password 2) correct username and wrong password 3) complete wrong credentials
  19. Marcin Sągol commented on patch set 3 V +1 CR +1 02/02/14, 18:30

    Works fine :) Before there was several entries generated like "Illegal string offset ...". Now only info about faild login attempt: Login-attempt from 127.0.0.1 (), username 'admin', password not accepted!
  20. Stefan Neufeind updated the commit message in patch set 3 02/02/14, 19:19

  21. Stefan Neufeind commented on patch set 4 02/02/14, 19:21

    @Stefano: By defaultthe warnings might not show for you - but they are there, because uid is not set and things like that. You could for example enable "full" errors via AdditionalConfiguration.php or the like.
  22. Stefan Neufeind commented on patch set 4 V +2 CR +2 02/02/14, 19:21

    Added 6.1 as well. Votes still stand.
  23. Stefan Neufeind merged patch set 5 02/02/14, 19:22

  24. Stefan Neufeind commented on patch set 5 02/02/14, 19:22

    Cherry Picked This patchset was cherry picked to change: I62b85816ce04720ed9fd236965c3a6f55effd093
  25. Mr. Jenkins commented on patch set 4 02/03/14, 03:41