Automattic / HyperDB

HyperDB is an advanced database class that supports replication, failover, load balancing, and partitioning.
104 stars 22 forks source link

Fatal error: Uncaught Error: Attempt to assign property "post_content" #134

Open hj-collab opened 1 year ago

hj-collab commented 1 year ago

Hello,

I have a WP network site. I am getting the below error when trying to create a new post. I am using the latest HyperDB from this repo.

Fatal error: Uncaught Error: Attempt to assign property "post_content" on null in /var/www/wp-admin/includes/post.php:762 Stack trace: #0 /var/www/wp-admin/post-new.php(66): get_default_post_to_edit() #1 {main} thrown in /var/www/wp-admin/includes/post.php on line 762 Configuration of db-config.php

<?php
/**
 * Register the primary server to HyperDB
 */
$wpdb->add_database( array(
        'host'     => 'xxx',
        'user'     => 'xxx',
        'password' => 'xxx',
        'name'     => 'xxx',
        'write'    => 1, // primary server takes write queries
        'read'     => 0,

) );

$wpdb->add_database( array(
        'host'     => 'localhost',
        'user'     => 'xxx',
        'password' => 'xxx',
        'name'     => 'xxx',
        'write'    => 0, 
        'read'     => 1, // read from local replica server

) );

Please help! Thank you!

hj-collab commented 1 year ago

Hi @sjinks,

I believe the above error is related to https://github.com/Automattic/HyperDB/pull/105.

Shouldn't the aforementioned request be merged? Why does Automattic have so many broken things on their repositories? I apologize, but I'm a bit disappointed.

I have switched to a fork of LudicrousDB until this is fixed. I hope some time and attention is given to HyperDB.

hj-collab commented 1 year ago

Please merge the pending pull requests. I have forked the HyperDB repo for now. https://github.com/Automattic/HyperDB/pull/135

sjinks commented 1 year ago

@vnsavage could you please take a look?