2

Civicrm 5.57.0 on Wordpress 6.1.1 Within a single contact you can leave notes. since the last update, if you want to view the notes, this error appears in the log file and nothing come up. When I press edit, the content of the note comes up. This is now the workaround to view the notes, just to press edit.

Jan 13 08:14:53  [error]
$Fatal Error Details = array:3 [
  "message" => "Expected to find one Note record, but there were multiple."
  "code" => null
  "exception" => CRM_Core_Exception {#8316
    -errorData: array:1 [
      "error_code" => 0
    ]
    #cause: null
    -_trace: null
    #message: "Expected to find one Note record, but there were multiple."
    #code: 0
    #file: "/var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php"
    #line: 1232
    trace: {
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1232 {
        › else {
        ›   throw new \CRM_Core_Exception("Expected to find one {$recordTypeLabel}, but there were multiple.");
        › }
      }
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/Result.php:90 { …}
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Note.php:37 { …}
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/Note.php:187 { …}
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319 { …}
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
      /var/www/civicrm/wp-content/plugins/civicrm/civicrm.php:1199 { …}
      /var/www/civicrm/wp-includes/class-wp-hook.php:308 { …}
      /var/www/civicrm/wp-includes/class-wp-hook.php:332 { …}
      /var/www/civicrm/wp-includes/plugin.php:517 { …}
      /var/www/civicrm/wp-admin/admin.php:259 { …}
    }
  }
]


Jan 13 08:14:53  [debug] $backTrace = #0 /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(441): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
#2 /var/www/civicrm/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:4))
#3 /var/www/civicrm/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress->invoke("")
#4 /var/www/civicrm/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters("", (Array:1))
#5 /var/www/civicrm/wp-includes/plugin.php(517): WP_Hook->do_action((Array:1))
#6 /var/www/civicrm/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
#7 {main}
6
  • 1
    Can you reproduce this on wpmaster.demo.civicrm.org ? I tried but it seems to work ok. Probably worth upgrading to 5.57.1 anyway as it has a few fixes.
    – Aidan
    Commented Jan 13, 2023 at 9:53
  • No sorry, I can´t reproduce this on wpmaster.demo.civicrm.org. But this is on version 5.59.alpha. Next I will update to 5.57.2 and hope this bug is gone! I will report!
    – Bernd
    Commented Jan 31, 2023 at 14:48
  • So, I updated to Version 5.57.3, same error and it´s not possible to view the notes...
    – Bernd
    Commented Feb 6, 2023 at 9:14
  • I have the same issue. I have verified that only one tuple exists in the database for the user viewed. Commented Apr 11, 2023 at 21:26
  • Did anyone solve this issue? I still have it on a CiviCRM 5.58.1.
    – Andreas
    Commented May 2, 2023 at 8:19

1 Answer 1

2

I found a fix:

I found out that this error is related to CiviMobileAPI. If this extension is deactivated everything works again. I found this error message regarding this:

[php:warn] [pid 235173] [client] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/civicrm/wp-content/uploads/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/ApiWrapper/Note.php on line 35, referer: https://domain.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcontact%2Fview&reset=1&cid=3&selectedChild=note

Edit the file:

civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/ApiWrapper/Note.php

https://lab.civicrm.org/extensions/civimobileapi/-/merge_requests/72/diffs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.