Automattic / syndication

Syndicate your WordPress content.
https://wordpress.org/plugins/syndication/
102 stars 47 forks source link

Fix fatal in class-syndication-logger.php #152

Open shantanu2704 opened 5 years ago

shantanu2704 commented 5 years ago

The Problem:

  1. on line 308: we are asking for a string to be returned.
  2. on line 311: If it's empty, we are converting it to an array
  3. on line 313: count() should throw a warning because it's being used on a string - Parameter must be an array or an object that implements Countable
  4. same on line 315
  5. on line 316: array_slice should throw a warning for the same reason - array_slice() expects parameter 1 to be array, ...
  6. on line 319: [] throws a fatal if $log is not an array - Caught Error: [] operator not supported for strings

Solution:

On line 308, don't pass in the third argument to get_post_meta(). By doing this, we make sure that the return value is an array( empty or otherwise ) and we avoid all the warnings/errors about the var not being an array.