Answers.Body: <p>An issue has been filed for this: <a href="https://lab.civicrm.org/dev/core/-/issues/4969" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/4969</a>
  with further discussion and some proposed fixes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-06T13:32:27.593Z
Answers.Text: Thank you, Coleman!
Answers.UserDisplayName: Jonny Toomey
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-05T19:35:26.063Z
Answers.LastActivityDate: 2024-02-05T19:35:26.063Z
Answers.UserDisplayName: Coleman
Body: <p>Just updated to CiviCRM 5.96.2 in a drupal 7 environment and got this error all of a sudden on only one of our domains (we're using multi-domain). Once it started i could access Civi at all using the affect domain. Very wierd. Anyone else experienced this issue?</p>
  <blockquote>
  <p>TypeError: in_array(): Argument #2 ($haystack) must be of type array,
  null given in in_array() (line 194 of
  .../civicrm/Civi/Angular/Manager.php).</p>
  </blockquote>
  <p>This is the code causing the issue. Essentially $module['basePage'] is null for one of the modules being looped through. I've temporarily stopped the error for occuring by adding an if is_array($modules['basePage']) on the value being passed.</p>
  <pre><code>  public function resolveDefaultModules($basePage) {
      $modules = $this-&gt;getModules();
      $result = [];
      foreach ($modules as $moduleName =&gt; $module) {
        if (in_array($basePage, $module['basePages']) || in_array('*', $module['basePages'])) {
          $result[] = $moduleName;
        }
      }
      return $result;
    }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-01T17:21:08.603Z
Comments.Text: It would be great if you could find out which extension has the angular module with a `null` value for `basePages`. Can you grep for the string "basePages" on your server to find it?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-01T17:32:15.117Z
Comments.Text: Hi Coleman, 
  
  I tried WATCHDOGing in the else condition of my hack but wasn't getting any results so I removed my hack and everything seems to be working again :-\
  
  I'll post back here if i figure out what it was and it might affect the wider community. Presumably it was some configuration of ours
Comments.UserDisplayName: Jonny Toomey
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-02T10:27:56.020Z
Comments.Text: Hi @Coleman - there are many many ang.php files which do not specify a 'basePages'. We're going to add some more logging to see if we can pinpoint which ones is causing the fatal on our contribution pages (intermittently??).
Comments.UserDisplayName: John
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-02T14:31:06.973Z
Comments.Text: It should be fine if the 'basePages' key is missing from the array, but not fine if it explicitly says `'basePages' => NULL` so check for any of those.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T08:54:59.860Z
Comments.Text: It's only every happening on the /transact/ path, and seems to include a large number of extensions. Rather than just the 'basePages' being missing, the whole of $module appears to be missing. We are print_r'ing the $module, but it's just empty, (not an empty array, just blank). Some module names which appear in our log:
  
  af 
  afformStandalone 
  crmStatusPage 
  jsonFormatter 
  unvalidatedJwtDecode 
  
  crmSearchDisplayTable 
  ui.bootstrap
  ui.sortable 
  unsavedChanges 
  crmAutosave
  
  ngRoute 
  crmQueueMonitor 
  dialogService
Comments.UserDisplayName: John
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T08:59:06.967Z
Comments.Text: could be related to this perhaps? https://github.com/civicrm/civicrm-core/commit/604cca726c6a238e0530b5f660ab0e11596da090#diff-b26b657986ef8b8163e79bcaf85afe628f6d5457193253bc6ff4c009cca44bf5
Comments.UserDisplayName: John
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T09:15:58.787Z
Comments.Text: So $moduleNames = $this->cache->get('moduleNames'); returns a list of module names. Then later it iterates over them and does: $angularModules[$moduleName] = $this->cache->get("module $moduleName"); but that doesn't exist in the cache, so it's just NULL.
Comments.UserDisplayName: John
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T16:11:22.883Z
Comments.Text: Raised an issue here: https://lab.civicrm.org/dev/core/-/issues/4969
Comments.UserDisplayName: John
Tags: <drupal>
Title: TypeError in_array - Angular Manager::resolveDefaultModules - civicrm version 5.69.2
ThreadText: # TypeError in_array - Angular Manager::resolveDefaultModules - civicrm version 5.69.2
  
  (Asked by: username_0 on 2024-02-01)
  
  Just updated to CiviCRM 5.96.2 in a drupal 7 environment and got this error all of a sudden on only one of our domains (we're using multi-domain). Once it started i could access Civi at all using the affect domain. Very wierd. Anyone else experienced this issue?
  
  TypeError: in_array(): Argument #2 ($haystack) must be of type array,
  null given in in_array() (line 194 of
  .../civicrm/Civi/Angular/Manager.php).
  
  This is the code causing the issue. Essentially $module['basePage'] is null for one of the modules being looped through. I've temporarily stopped the error for occuring by adding an if is_array($modules['basePage']) on the value being passed.
    public function resolveDefaultModules($basePage) {
      $modules = $this->getModules();
      $result = [];
      foreach ($modules as $moduleName => $module) {
        if (in_array($basePage, $module['basePages']) || in_array('*', $module['basePages'])) {
          $result[] = $moduleName;
        }
      }
      return $result;
    }
  
  **Tags:** drupal
  
  > **Comments:**
  > **username_1**: It would be great if you could find out which extension has the angular module with a `null` value for `basePages`. Can you grep for the string "basePages" on your server to find it?  
  > **username_0**: Hi username_1,   I tried WATCHDOGing in the else condition of my hack but wasn't getting any results so I removed my hack and everything seems to be working again :-\  I'll post back here if i figure out what it was and it might affect the wider community. Presumably it was some configuration of ours  
  > **username_2**: Hi @username_1 - there are many many ang.php files which do not specify a 'basePages'. We're going to add some more logging to see if we can pinpoint which ones is causing the fatal on our contribution pages (intermittently??).  
  > **username_1**: It should be fine if the 'basePages' key is missing from the array, but not fine if it explicitly says `'basePages' => NULL` so check for any of those.  
  > **username_2**: It's only every happening on the /transact/ path, and seems to include a large number of extensions. Rather than just the 'basePages' being missing, the whole of $module appears to be missing. We are print_r'ing the $module, but it's just empty, (not an empty array, just blank). Some module names which appear in our log:  af  afformStandalone  crmStatusPage  jsonFormatter  unvalidatedJwtDecode   crmSearchDisplayTable  ui.bootstrap ui.sortable  unsavedChanges  crmAutosave  ngRoute  crmQueueMonitor  dialogService  
  > **username_2**: could be related to this perhaps? https://github.com/civicrm/civicrm-core/commit/604cca726c6a238e0530b5f660ab0e11596da090#diff-b26b657986ef8b8163e79bcaf85afe628f6d5457193253bc6ff4c009cca44bf5  
  > **username_2**: So $moduleNames = $this->cache->get('moduleNames'); returns a list of module names. Then later it iterates over them and does: $angularModules[$moduleName] = $this->cache->get("module $moduleName"); but that doesn't exist in the cache, so it's just NULL.  
  > **username_2**: Raised an issue here: https://lab.civicrm.org/dev/core/-/issues/4969  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-02-05. Score: 2 | Accepted answer
  
  An issue has been filed for this: <https://lab.civicrm.org/dev/core/-/issues/4969>
  with further discussion and some proposed fixes.
  
  > **Comments:**
  > **username_0**: Thank you, username_1!  
  
  ---
  
  