wordpress 2.1.3 with php 7.0
I am updating wordpress 2.1.3 to work with php7. I have already been able to install it, after modifying multiple files, but I have a problem now
When I want to enter the control panel give the error “You do not have sufficient permissions to access this page.”, It seems to me that this error is related to “wp_user_roles” in table wp_options since the only error that it marks in the php log is in the capabilities.php file, precisely in the wp_roles function.
The errors are marked in two functions below, it seems a simple error but I could not solve it. everything seems correct, I have already tried several versions
“PHP Warning: Illegal string offset … in … capabilities.php”
in class WP_Roles:
function add_cap( $role, $caps, $grant = true ) {
if ( ! isset( $this->roles[$role] ) )
return;
$this->roles[$role]['capabilities'][$caps] = $grant;
if ( $this->use_db )
update_option( $this->role_key, $this->roles );
}
in class WP_Role
function add_cap($caps, $grant = true) {
global $wp_roles;
if ( ! isset($wp_roles) )
$wp_roles = new WP_Roles();
$this->capabilities[$caps] = $grant;
$wp_roles->add_cap($this->name, $caps, $grant);
}
In the table wp_usermeta, in the wp_cababilities seems “a:1:{s:13:”administrator”;b:1;}”, what i think is correct.
But in the table wp_options, in the wp_user_roles seems
a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";s:1:"1";}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";s:1:"1";}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";s:1:"1";}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";s:1:"1";}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";s:1:"1";}}
I don’t know if it’s correct because not seems multiples options, edit theme, edit user, edit pages, etcétera.
any good idea? thank you
Leave an answer