Errors – Illegal String Offsets and Header Modification Warnings
-
These are the errors I get when I try to edit my wordpress pages. The theme I’m using is Illdy, and my hosting is with Hostgator. Maybe it has to do with WordPress updates? Help!! Diana
Warning: Illegal string offset ‘capabilities’ in /home2/pcm/public_html/wp-includes/class-wp-roles.php on line 288
Warning: Illegal string offset ‘name’ in /home2/pcm/public_html/wp-includes/class-wp-roles.php on line 289
Warning: Cannot modify header information – headers already sent by (output started at /home2/pcm/public_html/wp-includes/class-wp-roles.php:288) in /home2/pcm/public_html/wp-includes/pluggable.php on line 1251
Warning: Cannot modify header information – headers already sent by (output started at /home2/pcm/public_html/wp-includes/class-wp-roles.php:288) in /home2/pcm/public_html/wp-includes/pluggable.php on line 1254
The blog I need help with is: (visible only to logged in users)
-
ILLEGAL STRING OFFSET: Here’s the code I’m seeing for the “illegal string offset” warnings.
line 288: $this->role_objects[ $role ] = new WP_Role( $role, $this->roles[ $role ][‘capabilities’] );
line 289 $this->role_names[ $role ] = $this->roles[ $role ][‘name’];
*/
public function init_roles() {
if ( empty( $this->roles ) ) {
return;
}$this->role_objects = array();
$this->role_names = array();
foreach ( array_keys( $this->roles ) as $role ) {
$this->role_objects[ $role ] = new WP_Role( $role, $this->roles[ $role ][‘capabilities’] );
$this->role_names[ $role ] = $this->roles[ $role ][‘name’];
}/**
* After the roles have been initialized, allow plugins to add their own roles.
*
* @since 4.7.0
*
* @param WP_Roles $this A reference to the WP_Roles object.
*/
do_action( ‘wp_roles_init’, $this );
}/**
HEADER WARNINGS: Here’s the code I’m seeing for the header warnings.
line 1251: header( “X-Redirect-By: $x_redirect_by” );
line 1254: header( “Location: $location”, true, $status );
function wp_redirect( $location, $status = 302, $x_redirect_by = ‘WordPress’ ) {
global $is_IIS;/**
* Filters the redirect location.
*
* @since 2.1.0
*
* @param string $location The path or URL to redirect to.
* @param int $status The HTTP response status code to use.
*/
$location = apply_filters( ‘wp_redirect’, $location, $status );/**
* Filters the redirect HTTP response status code to use.
*
* @since 2.3.0
*
* @param int $status The HTTP response status code to use.
* @param string $location The path or URL to redirect to.
*/
$status = apply_filters( ‘wp_redirect_status’, $status, $location );if ( ! $location ) {
return false;
}$location = wp_sanitize_redirect( $location );
if ( ! $is_IIS && PHP_SAPI != ‘cgi-fcgi’ ) {
status_header( $status ); // This causes problems on IIS and some FastCGI setups
}/**
* Filters the X-Redirect-By header.
*
* Allows applications to identify themselves when they’re doing a redirect.
*
* @since 5.1.0
*
* @param string $x_redirect_by The application doing the redirect.
* @param int $status Status code to use.
* @param string $location The path to redirect to.
*/
$x_redirect_by = apply_filters( ‘x_redirect_by’, $x_redirect_by, $status, $location );
if ( is_string( $x_redirect_by ) ) {
header( “X-Redirect-By: $x_redirect_by” );
}header( “Location: $location”, true, $status );
return true;
}
endif; -
You are using the WordPress.org version of the WordPress software on a site hosted at hostgator.
For forum assistance on the version of WordPress you are using on your site you would use the forums at WordPress.org . You will need to sign up with those forums to post there.
https://wordpress.org/support/forums/For more on the differences between WordPress.com and WordPress.org see:
- The topic ‘Errors – Illegal String Offsets and Header Modification Warnings’ is closed to new replies.