0

After updating to PHP 7 I get this warning:

Warning: in_array() expects parameter 2 to be array, null given

The code is refering to:

    $post_type = WPAlchemy_MetaBox::_get_current_post_type();

    if (isset($post_type) AND ! in_array($post_type, $this->types))
    {
        $can_output = FALSE;
    }

    // filter: output (can_output)
    if ($this->has_filter('output'))
    {
        $can_output = $this->apply_filters('output', $post_id);
    }

    return $can_output;

And specifically this line:

if (isset($post_type) AND ! in_array($post_type, $this->types))

Which excatly is null? How can I fix this?

Noob2013
  • 27
  • 6
  • *Which excatly is null* > error is **in_array() expects parameter 2 to be array**. So `$this->types` is null – β.εηοιτ.βε Mar 25 '21 at 20:24
  • Does this answer your question? [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) and more specifically the answer https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/52771226#52771226 – β.εηοιτ.βε Mar 25 '21 at 20:26
  • Thank you, I do understand the logic behind, but I can't do it successfully as $this->types shouldn't be null. – Noob2013 Mar 26 '21 at 12:10

0 Answers0