Type Error

TypeError: Argument 1 passed to _search_api_override_apply_single_override() must be an instance of [error]
SearchApiServer, instance of SearchApiIndex given, called in
/var/www/html/sites/all/modules/contrib/search_api_override/search_api_override.module on line 139 in
_search_api_override_apply_single_override() (line 160 of
/var/www/html/sites/all/modules/contrib/search_api_override/search_api_override.module).

This is because the code standards were updated, giving the function parameter the type SearchApiServer:

function _search_api_override_apply_single_override(SearchApiServer $component, array $override) {

But a different issue changed this to be either a server or an index. Passing a SearchApiIndex as a parameter throws the error shown.

Undefined Variable

In the same function mentioned above, the issue for overriding the "enabled" state added

  if (isset($override['enabled'])) {
    $server->enabled = $override['enabled'];
  }

But this needs to now be the following because the param name is now $component (because server|index are both supported).

  if (isset($override['enabled'])) {
    $component->enabled = $override['enabled'];
  }

---

A patch for the two issues is attached.

Comments

solideogloria created an issue. See original summary.

solideogloria’s picture

Version: 7.x-1.x-dev » 7.x-1.0
solideogloria’s picture

StatusFileSize
new1.04 KB
solideogloria’s picture

Status: Active » Needs review
solideogloria’s picture

StatusFileSize
new4.79 KB

Might as well fix some typos while we're at it...

sgdev’s picture

Status: Needs review » Reviewed & tested by the community

Noticed this as soon as I reviewed a diff of the 7.x-1.0 updates. Needs to be fixed for anyone who enables using the array, or else there will be issues.

sgdev’s picture

Actually if making updates to typos, how about fixing "beeing" to "being" on line 311...

And all the typos in the @file at the top (lines 10 through 16)... "overriden", "inital":

 * The module uses one of two modes:
 * - load: the server|index configuration is overriden on every load. This way
 *   the settings cannot be overriden via the backend.
 * - default: the configuration is set via the default hook. This way the
 *   configuration is set on inital import or a features revert for the given
 *   feature. By choosing that option, you can override the settings in the
 *   backend.
sgdev’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new7.26 KB

Kept finding more typos and just thought it best to create an updated patch. See attached.

solideogloria’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

solideogloria’s picture

Could we get this committed and released soon?

avpaderno’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs work

Fixing typos in comments is out-of-scope for this issue.

solideogloria’s picture

Status: Needs work » Reviewed & tested by the community

@kiamlaluno, then use patch #3. It has no typos fixed.

solideogloria’s picture

  • vuil committed 3ecd60e on 7.x-1.x authored by ron_s
    Issue #3109309 by solideogloria, ron_s, vuil: TypeError and Undefined...
vuil’s picture

Status: Reviewed & tested by the community » Fixed

The patch of #3 is already committed.

sgdev’s picture

Created a patch covering all the spelling mistakes and typos included in #8.

Ready for review: https://www.drupal.org/project/search_api_override/issues/3135714

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.