Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@shantanu2704
Copy link

@shantanu2704 shantanu2704 commented Dec 17, 2018

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.

@GaryJones GaryJones changed the base branch from master to develop February 11, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant