0

I have been following the instructions for installing to Multisite here:

https://docs.civicrm.org/installation/en/latest/multisite/wordpress/

I created a separate civicrm database.

I set the CiviCRM installation (5.68.0) running. It did stuff for a minute or two, then came back with a fatal error.

The PHP log has an error starting with this:


Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, int given in /home/<userDIR>/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:2807

When I go to look at that line in the file, it has this:

if (method_exists($result, 'numRows')) {
            if ($_DB_driver == 'DB') {
                $DB->expectError(DB_ERROR_UNSUPPORTED);
            } else {
                $DB->expectError(MDB2_ERROR_UNSUPPORTED);
            }

In my searching on the web, I saw some comments that PHP 8 had made it a fatal error if the first parameter to method_exists() was not a string or an object.

In the stack trace, the first line is:

Stack trace:
#0 /home/<userDIR>/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2807): method_exists(1, 'numRows')

Hence it does seem that $result is passing an integer, not a string or object.

This seems like a check has to be made in the code, but it hasn't been.

1 Answer 1

0

The problem you're referring to was fixed a long time ago, so it seems you are using a very old version of CiviCRM. Please upgrade to the latest version to get the latest fixes :)

3
  • No. As I said in my post I am trying to install Civi CRM 5.68.0. Which is the latest available. Commented Dec 11, 2023 at 21:24
  • 1
    That's strange because line 2807 in 5.68 doesn't point to the code you pasted, and also the code you pasted no longer exists in 5.68 due to the fix I mentioned in my answer.
    – Coleman
    Commented Dec 11, 2023 at 22:29
  • This is weird. The code I have / had was as described. I went and checked the ZIP file of the CiviCRM version. And the code is as you described. I removed all the CiviCRM plugin directories and files from upload, deleted the CiviCRM database tables. Then re-extracted the CiviCRM plugin, and followed the istructions again. This time it worked. I even double checked the file mentioned, and the code is as you say. I have no explanation for the bad file. I will note that at the top of the file it only references PHP up to v6. And no references at all to the version of CiviCRM Commented Dec 11, 2023 at 22:39

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.