With PHP < 5.5, this results in an error:


  //Determine if it's a user or node
  $node = isset($form_state['node']) && !empty($user = is_object($form_state['node']));
  $user = isset($form_state['user']) && is_object($form_state['user']) && !empty($form_state['user']);
 

Because empty() only supports variables. Also, $user is being set and then being reassigned on the next line.

Comments

kevinwalsh created an issue. See original summary.

generalconsensus’s picture

Thanks for the bug report, will look into this week!

kevinwalsh’s picture

Issue summary: View changes
kevinwalsh’s picture

Status: Active » Needs review
StatusFileSize
new689 bytes

This resolves the errors on php 5.4.x and below, and removes a redundant isset().

  • generalconsensus committed 862406d on 7.x-2.x
    Issue #2869154 by kevinwalsh: Errors when checking whether it's a $user...
generalconsensus’s picture

Status: Needs review » Fixed

Thanks for patch, committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.