Argument #2 ($haystack) must be of type array, null given in in_array()

Created on 20 February 2023, almost 2 years ago
Updated 18 March 2023, almost 2 years ago

Problem/Motivation

TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 75 of /app/html/modules/contrib/blazy/blazy.post_update.php)

Steps to reproduce

On performing updb with php8

Proposed resolution

Validate by is_array()

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Closed: duplicate

Version

2.0

Component

Miscellaneous

Created by

🇮🇳India nikhilesh gupta Hyderabad

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nikhilesh gupta
  • Status changed to Needs review almost 2 years ago
  • 🇮🇩Indonesia gausarts

    Thank you.

    I couldn't reproduce it. What was your previous Blazy version?

    FYI, regarding the failed D10 tests, Drupal 10 requires PHP8+, not PHP7.

  • 🇮🇩Indonesia gausarts

    The IF statement is indeed weak, I'll be happy to put your patch in, no problem.

    But the error is questionable, and I could not reproduce it, so your more details are required.

    Please paste the entire error block for further checks, and so to pinpoint the actual issue better.

    AFAIK, CMIIW, the dependencies.module can only return two values:
    If not an array of values, it is an undefined index warning.

    From more than 30 different exported configs, I could not find NULL or empty value of the module directive like your errors, unless you manually removed the array, and kept the module key empty which should not happen under normal circumstances.

    So just for accountability of the issue, is it a genuine error, or are you making it up as identified above?

    This is an intriguing error. No harsh question was intended, but I would appreciate a genuine error. Do not hesitate to correct me :)

  • Issue was unassigned.
  • Status changed to Closed: duplicate almost 2 years ago
  • 🇮🇩Indonesia gausarts

    When you create a View, you must choose an entity for the Views system to begin and work with. Each entity (node, user, media, etc.) is governed by a module. Thus Views will automatically populate dependencies on those modules, even if you left your view empty or untouched.

    My tentative conclusion, 99% is potentially correct:
    Dependencies of a view are guaranteed an array, not NULL, nor undefined.
    1% is left for a special edge case, if any, or my own ignorance. But without more details, I can say it is impossible to reproduce your issues unless you hijack or bypass that system, manually or programmatically, intentionally or ignorantly, as identified above.

    In that case, it is your own unique issue, unless you provide us a repro. Errors must be reproducible, and not unique.

    I would appreciate better if you put your patch under Enhancement, and be honest with potential errors, instead.

    Regarding the weakness, that line is actually redundant, not needed. It must be there due to unnecessary in-confidence, but leaving it for now won't hurt, either. Fixing it is not even necessary until proven otherwise.

    However feel free to re-open and correct me if anyone encounter this particular issue.
    Be sure to provide detailed error messages for a reproduction. No repro, no bugs, as noted in Blazy docs.

    I am still open for that 1%. Once I can reproduce it, I'll happily stand corrected.

    Unfortunately, the OP is unnecessarily being mysterious by cutting off the important error message, and not replying for a repro for a while. 99% of the issues were fixed thanks to the complete error messages. The first 20 lines are normally the actual error lines, the rest are the underlying root cause which were not provided.

    There was a slightly similar issue to this one, and also not reproducible, that is why a dup.

Production build 0.71.5 2024