Skip to content

Undefined offset: 1 in p.php, line 211 #1758

@michaelmohamed

Description

@michaelmohamed

Hi, I am getting this error on my redux settings page.

Undefined offset: 1 in p.php, line 211 #1758

It is because the preg_match returns one element in the array (atleast for me).

Because we are expecting two elements in the returned array, the solution would be to initialize an empty array with two elements, and perform a merge (just in case preg_split does not return two elements).

list( $header, $contents ) = array_merge( array( '', '' ), preg_split( '/([\r\n][\r\n])\1/', curl_exec( $ch ), 2 ) );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions