Review main Merged

18978[BUGFIX] Fix PHP warning in BackendUtility::lockRecords

Helmut Hummel CR +2 V +2 Easy +16 −14 updated 06/03/13, 20:49

Commit message

This methods triggers a warning "Illegal String offset"
with PHP 5.4, because $GLOBALS['BE_USER']->user['uid'] is accessed
even if a user is not logged in.

Additionally a delete query is executed in this case which
does not make sense at all.

Properly check if a user is logged in before executing any
functionality in this method.

Review

  • Code review CR +2
    • Christian Kuhn +2
    • Markus Klein +1
  • Verified V +2
    • Christian Kuhn +2

Files 1

Review log 17

  1. Stefan Neufeind commented on patch set 2 1 comment 03/17/13, 21:20

    Looks good to me, but someone else must approve I agree we should reduce the number of checkes (see inline). But in general fine with me.
  2. Markus Klein commented on patch set 2 03/17/13, 21:20

    Looks good to me, but someone else must approve

    BackendUtility.php:2940

    Just one more nitpick. Since this is now a pretty simple check, I'd suggest to negate the condition and make it a guard clause with a simple return statement.

    BackendUtility.php:2945

    Do we really need that many checks here? Wouldn't it suffice to do the first two checks?
  3. Helmut Hummel uploaded patch set 2 03/17/13, 21:20

  4. Helmut Hummel uploaded patch set 3 03/17/13, 21:20

  5. Helmut Hummel commented on patch set 3 03/17/13, 21:20

    Thanks for the feedback. isset($GLOBALS['BE_USER']->user['uid'])) indeed handles both cases (BE_USER not set and user['uid'] not set) correctly and does neither throw warnings nor notices
  6. Markus Klein commented on patch set 4 1 comment 03/17/13, 21:20

    Looks good to me, but someone else must approve
  7. Helmut Hummel uploaded patch set 4 03/17/13, 21:20

  8. Helmut Hummel commented on patch set 4 03/17/13, 21:20

    updated commit message to include this into older releases (LTS in particular) since it has been reported as a problem also in these versions
  9. Christian Kuhn commented on patch set 2 03/17/13, 21:20

    Looks good to me, but someone else must approve will test soon.

    BackendUtility.php:2940 Reply

    imho not really needed.
  10. Christian Kuhn commented on patch set 4 03/17/13, 21:20

    (1 inline comment)
  11. Mattias Nilsson commented on patch set 2 03/17/13, 21:20

    Looks good to me, but someone else must approve
  12. Mr. Jenkins commented on patch set 1 03/17/13, 21:20

  13. Mr. Jenkins commented on patch set 2 03/17/13, 21:20

  14. Mr. Jenkins commented on patch set 3 03/17/13, 21:20

  15. Mr. Jenkins commented on patch set 4 03/17/13, 21:20

  16. Christian Kuhn commented on patch set 4 V 0 03/17/13, 21:20

    by team member; Looks good to me, approved
  17. Christian Kuhn merged patch set 5 03/17/13, 21:20