When trying to access a View page with a search sort block on it, after updating to 7.x-1.x-dev I got:
Fatal error: Cannot use object of type stdClass as array in ..../search_api_sorts/search_api_sorts.module on line 151
<?php
function search_api_sorts_search_sorts($index_id, $enabled = 1, $reset = FALSE) {
.....
$index = search_api_index_load($index_id);
while ($row = $query->fetch()) {
// Check that this field exists in index.
if (!empty($index->options['fields'][$row['field']])) {
?>
I am working on a Commerce Kickstart site trying to upgrade to the current version from rc2. It's pretty difficult as something in the search index setup doesn't want to show the sort block. I tried changing the module back to the older version and I still got this fatal error. Is this related to the recent updates on search_api and search_api_db ?
Wish it were easier to diagnose this monster - I tried updating the search_api modules to their new versions just released via drunken_monkey and same result. Also tried changing it to $index = search_api_index_load($index_id, true); to reset the cache on that call.
Comment | File | Size | Author |
---|---|---|---|
#4 | cannot-use-object-type-stdclass-as-array-2153251.patch | 553 bytes | Finn Lewis |
Comments
Comment #1
HongPong CreditAttribution: HongPong commentedComment #2
HongPong CreditAttribution: HongPong commentedI was able to get out of the Fatal Error situation by restoring back to version 7.x-1.4 .
Comment #3
samuel.mortensonI also got this after an update from an older dev version to the most recent version of dev, ended up reverting to fix the error.
Comment #4
Finn Lewis CreditAttribution: Finn Lewis commentedAs far as I can tell, this is because the line
shoule be
Patch attached against current dev version.
Comment #5
alanmackenzie CreditAttribution: alanmackenzie commentedPatch in #4 works as described.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedCommitted to dev-x
http://drupalcode.org/project/search_api_sorts.git/commit/e7a3aa8