Answers.Body: <p>The problem you're referring to was <a href="https://github.com/civicrm/civicrm-packages/commit/87aee426385676b8b6d58789ef9b3fdf0322a1a3" rel="nofollow noreferrer">fixed a long time ago</a>, so it seems you are using a very old version of CiviCRM. Please upgrade to the latest version to get the latest fixes :)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-11T21:24:39.250Z
Answers.Text: No. As I said in my post I am trying to install Civi CRM 5.68.0. Which is the latest available.
Answers.UserDisplayName: Norman Cates
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-11T22:29:57.577Z
Answers.Text: That's strange because [line 2807 in 5.68](https://github.com/civicrm/civicrm-packages/blob/5.68/DB/DataObject.php#L2807) 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.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-11T22:39:10.953Z
Answers.Text: 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
Answers.UserDisplayName: Norman Cates
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-11T20:47:04.070Z
Answers.LastActivityDate: 2023-12-11T20:47:04.070Z
Answers.UserDisplayName: Coleman
Body: <p>I have been following the instructions for installing to Multisite here:</p>
  <p><a href="https://docs.civicrm.org/installation/en/latest/multisite/wordpress/" rel="nofollow noreferrer">https://docs.civicrm.org/installation/en/latest/multisite/wordpress/</a></p>
  <p>I created a separate civicrm database.</p>
  <p>I set the CiviCRM installation (5.68.0) running. It did stuff for a minute or two, then came back with a fatal error.</p>
  <p>The PHP log has an error starting with this:</p>
  <hr />
  <pre><code>Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, int given in /home/&lt;userDIR&gt;/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:2807
  </code></pre>
  <hr />
  <p>When I go to look at that line in the file, it has this:</p>
  <pre><code>if (method_exists($result, 'numRows')) {
              if ($_DB_driver == 'DB') {
                  $DB-&gt;expectError(DB_ERROR_UNSUPPORTED);
              } else {
                  $DB-&gt;expectError(MDB2_ERROR_UNSUPPORTED);
              }
  </code></pre>
  <p>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.</p>
  <p>In the stack trace, the first line is:</p>
  <pre><code>Stack trace:
  #0 /home/&lt;userDIR&gt;/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2807): method_exists(1, 'numRows')
  </code></pre>
  <p>Hence it does seem that $result is passing an integer, not a string or object.</p>
  <p>This seems like a check has to be made in the code, but it hasn't been.</p>
  
Tags: <installation><install><php8>
Title: I am trying to install CiviCRM to a Wordpress multisite, and getting an error Uncaught TypeError: method_exists()
ThreadText: # I am trying to install CiviCRM to a Wordpress multisite, and getting an error Uncaught TypeError: method_exists()
  
  (Asked by: username_0 on 2023-12-11)
  
  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.
  
  **Tags:** installation, install, php8
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-12-11. Score: 0
  
  The problem you're referring to was [fixed a long time ago](https://github.com/civicrm/civicrm-packages/commit/87aee426385676b8b6d58789ef9b3fdf0322a1a3), so it seems you are using a very old version of CiviCRM. Please upgrade to the latest version to get the latest fixes :)
  
  > **Comments:**
  > **username_0**: No. As I said in my post I am trying to install Civi CRM 5.68.0. Which is the latest available.  
  > **username_1**: That's strange because [line 2807 in 5.68](https://github.com/civicrm/civicrm-packages/blob/5.68/DB/DataObject.php#L2807) 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.  
  > **username_0**: 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  
  
  ---
  
  