Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
fixes #436 Illegal string offset and Invalid argument in FlashMessages
Browse files Browse the repository at this point in the history
fixes #436 error occurs when trying to add message to messages when
messages is not a valid array, permitted in php7.0 and earlier but not
in php 7.1.  Not reproduced but fixed by adding defensive code to
ensure array is always initialised.
  • Loading branch information
Jon007 committed Jun 29, 2019
1 parent 09cbf1f commit feedc68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Hyyan/WPI/Tools/FlashMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public static function getOptionName()
*/
private static function getMessages()
{
$messages = get_option( static::getOptionName(), array() );
if ( ! is_array( $messages ) ) {
$messages = array();
}
return $messages;
return get_option(static::getOptionName(), array());
}
}

0 comments on commit feedc68

Please sign in to comment.