• Resolved Angelverde

    (@angelverde)


    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 https://noticias.buapos.com works properly, but https://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 https://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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Angelverde

    (@angelverde)

    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.

    Thread Starter Angelverde

    (@angelverde)

    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.

    Thread Starter Angelverde

    (@angelverde)

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot use string offset as an array in wp-includes/capabilities.php inMigration’ is closed to new replies.