WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Cannot use string offset as an array in wp-includes/capabilities.php inMigration (6 posts)

  1. Angelverde
    Member
    Posted 2 years ago #

    After doing a migration (url and server) from buapos.com to forosbuap.mx some sites stopped working with this error:

    After doing a migration (url and server) buapos.com forosbuap.mx to some sites stopped working with this error:

    Fatal error: Can not use string offset as an array in / home / Mius / public_html / wp-includes / capabilities.php on line 112

    This only happens on some sites, for example http://noticias.buapos.com works properly, but http://iklae.buapos.com/ not work.

    If visiting as a guest, the site can be displayed to the header, but as administrator the site does not show anything.

    Try disabling the plugins without success.

    The only change was in the url of each site.
    This only happens on some sites, for example noticias.buapos.com works properly, but http://iklae.buapos.com/ not work.

    If visiting as a guest, the site can be displayed to the header, but as the site administrator does not show anything.

    Try disabling the plugins without success.

    The only change was in the url of each site.
    -------
    Sorry for my poor english. Thanks.

  2. Angelverde
    Member
    Posted 2 years ago #

  3. James Edmonston
    Member
    Posted 2 years ago #

    Can you paste the line that's causing the error?

    It could be down to a wide variety of things - one of which could be the PHP version that the server is running.

  4. Angelverde
    Member
    Posted 2 years ago #

    The function:

    /**
    	 * Set up the object properties.
    	 *
    	 * The role key is set to the current prefix for the $wpdb object with
    	 * 'user_roles' appended. If the $wp_user_roles global is set, then it will
    	 * be used and the role option will not be updated or used.
    	 *
    	 * @since 2.1.0
    	 * @access protected
    	 * @uses $wpdb Used to get the database prefix.
    	 * @global array $wp_user_roles Used to set the 'roles' property value.
    	 */
    	function _init () {
    		global $wpdb, $wp_user_roles;
    		$this->role_key = $wpdb->prefix . 'user_roles';
    		if ( ! empty( $wp_user_roles ) ) {
    			$this->roles = $wp_user_roles;
    			$this->use_db = false;
    		} else {
    			$this->roles = get_option( $this->role_key );
    		}
    
    		if ( empty( $this->roles ) )
    			return;
    
    		$this->role_objects = array();
    		$this->role_names =  array();
    		foreach ( (array) $this->roles as $role => $data ) {
    			$this->role_objects[$role] = new WP_Role( $role, $this->roles[$role]['capabilities'] );
    			$this->role_names[$role] = $this->roles[$role]['name'];
    		}
    	}

    Line 112:
    $this->role_objects[$role] = new WP_Role( $role, $this->roles[$role]['capabilities'] );

    is the same code for all sites and only few not are working.

  5. Angelverde
    Member
    Posted 2 years ago #

  6. Stormtribe Development
    Member
    Posted 2 years ago #

    Had the same error. By turning off magic quotes in php.ini and be sure that the files you import in phpmyadmin is in utf-8, if you choose utf-8 in phpmyadmin.

Topic Closed

This topic has been closed to new replies.

About this Topic