Title: Error on PHP 5.4.0
Last modified: August 20, 2016

---

# Error on PHP 5.4.0

 *  Resolved [Marcus Downing](https://wordpress.org/support/users/marcusdowning/)
 * (@marcusdowning)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-540/)
 * PHP 5.4.0 removed the call-time pass-by-reference feature, so trying to use this
   plugin results in the error:
 * > Fatal error: Call-time pass-by-reference has been removed in /home/mdowning/
   > Projects/data/itso/htdocs/wp-content/plugins/user-access-manager/class/UamUserGroup.
   > class.php on line 646
 * This is due to the following code:
 *     ```
       $this->objects[$objectType][$type]
         = $plObject['reference']->($plObject['getFullObjects']}(
           $this->objects[$objectType][$type],
           &$this
         );
       ```
   
 * [http://wordpress.org/extend/plugins/user-access-manager/](http://wordpress.org/extend/plugins/user-access-manager/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [AndrewJHart](https://wordpress.org/support/users/andrewjhart/)
 * (@andrewjhart)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209039)
 * this is true but it should be a simple fix; I do not use this plugin however 
   PHP now defaults to passing by reference, so theres nothing wrong with the way
   the function is defined but there is a problem with the way it is called now!
 * New versions of PHP no longer require a pass by reference to implicitly require
   the & before the variable when passed as a param.
 * the simple fix: Edit the line near 646 that passes the ‘this’ object by reference.
   Change &$this to just $this (php knows its passed by reference because the function
   should declare it).
 * You will also need to edit line 995 and do the same thing.
 * this was done in new version of php for code cleanliness – basically the function
   declaration decides how the variable is passed, not the caller.
 * Drew
 *  [swartlkk](https://wordpress.org/support/users/swartlkk/)
 * (@swartlkk)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209090)
 * I have edited the reference & have gotten past the fatal error and now the plugin
   can activate, however there are even more problems with this plugin. Once this
   error was corrected, my site now renders correctly when logged in. However, when
   not logged in, I get warnings on the main page.
 * > Warning: Creating default object from empty value in …/wp-content/plugins/user-
   > access-manager/class/UamAccessHandler.class.php on line 678
 * Line 678 is part of this function call:
 *     ```
       /**
            * Return the role of the user.
            *
            * @param integer $userId The user id.
            *
            * @return string|null
            */
           private function _getUserRole($userId)
           {
               global $wpdb;
   
               $curUserdata = get_userdata($userId);
   
               if (!isset($curUserdata->user_level)) {
                   $curUserdata->user_level = null;
               }
   
               if (isset($curUserdata->{$wpdb->prefix . "capabilities"})) {
                   $capabilities = $curUserdata->{$wpdb->prefix . "capabilities"};
               } else {
                   $capabilities = null;
               }
   
               $role  = (is_array($capabilities) && count($capabilities) > 0) ? array_keys($capabilities) : array('norole');
   
               return trim($role[0]);
           }
       ```
   
 * Specifically the “$curUserdata->user_level = null;” line.
 * Your help is greatly appreciated!
 * I have disabled all error reporting which has returned my home page to it’s former
   state & everything seems to be working as it should, but I would like to know
   how to fix this appropriately.
 *  [akiko.pusu](https://wordpress.org/support/users/akikopusu/)
 * (@akikopusu)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209120)
 * Hello.
    Thanks for this information, I could activate this plugin. But I still
   have the same worning, such as
 * > Warning: Creating default object from empty value in …/wp-content/plugins/user-
   > access-manager/class/UamAccessHandler.class.php on line 678
 * So I did change the line 678 and warning was stopped.
    I’m not sure if this workaround
   is correct or not…
 * >  if (!empty($curUserdata->user_level) && !isset($curUserdata->user_level)) {
   > /*
   > if (!isset($curUserdata->user_level)) { */ $curUserdata->user_level = null;}
 *  [Hemang](https://wordpress.org/support/users/hemanggandhi/)
 * (@hemanggandhi)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209122)
 * Trying to use this plugin results in the error:
 * Fatal error: Call-time pass-by-reference has been removed in /home/mdowning/Projects/
   data/itso/htdocs/wp-content/plugins/user-access-manager/class/UamUserGroup.class.
   php on line 646
 * I tried to remove the ‘&’ from line 646 and 995, but then it shows error as Plugin
   activation shows a Fatal error and no error description. I have updated my xampp
   for linux to xampp version 1.8.1 which has php version 5.4.7. Can you tell me
   if any other change is required?
 *  [jloosli](https://wordpress.org/support/users/jloosli/)
 * (@jloosli)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209124)
 * I was receiving the same error, but I after changing:
 * `&$this`
 * to
 * `$this`
 * on lines 645 and 994, it worked
 *  [axeldev](https://wordpress.org/support/users/axeldev/)
 * (@axeldev)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209125)
 * Hello,
 * I made the changes posted by jloosli in UamUserGroup.class.php and it worked 
   for me too.
 *  Plugin Author [gm_alex](https://wordpress.org/support/users/gm_alex/)
 * (@gm_alex)
 * [13 years ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209126)
 * Fixed since version 1.2.3

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Error on PHP 5.4.0’ is closed to new replies.

 * ![](https://ps.w.org/user-access-manager/assets/icon.svg?rev=1563783)
 * [User Access Manager](https://wordpress.org/plugins/user-access-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-access-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-access-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/user-access-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-access-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-access-manager/reviews/)

 * 7 replies
 * 8 participants
 * Last reply from: [gm_alex](https://wordpress.org/support/users/gm_alex/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/error-on-php-540/#post-3209126)
 * Status: resolved