Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#30538 closed defect (bug) (fixed)

Cannot edit older posts

Reported by: matze310706's profile matze310706 Owned by: pento's profile pento
Milestone: 4.1 Priority: normal
Severity: major Version: 4.1
Component: Database Keywords:
Focuses: Cc:

Description

I've been having a problem with editing older posts. Let's just say there is a misspelling I want to fix. After fixing and saving, WordPress tells me the post is updated but the misspelling is still there.

My error log tells me the 'posts' table doesn't exist for 'SHOW FULL COLUMNS FROM' (refering to 'edit_post, wp_update_post, wp_insert_post, referer: <page>/wp-admin/post.php?post=<ID>&action=edit'). It tells me that twice. Then I've got a message that 'mb_check_encoding' requires parameter 1 as string not as the object given, and then again I've got a third but same message about the 'posts' table.

The error occures with two WP installations (both revision 30608 at the moment) and with PHP 5.3.x and 5.5.x.

Change History (13)

This ticket was mentioned in Slack in #core by johnbillion. View the logs.


10 years ago

#2 @johnbillion
10 years ago

  • Component changed from General to Database
  • Milestone changed from Awaiting Review to 4.1
  • Severity changed from normal to major

#3 @pento
10 years ago

Thanks for the bug report, @matze310706!

Could you please post a full copy of the error log lines you've seen? Feel free to remove any sensitive information from them before you post them.

#4 @pento
10 years ago

Also, do you happen to have any plugins installed and activated? If so, please post a list of them.

#5 @matze310706
10 years ago

I've got a few plugins but I disabled all of them to see if this could be the problem. It isn't. I even changed to a theme I've never modified. Problem still exists.

Here is my error.log. Parts are in German (because I am) but it shouldn't be hard to translate.

[Sun Nov 30 16:38:51.115880 2014] [:error] [pid 2911] [client 127.0.0.1:39768] WordPress-Datenbankfehler Table 'xxxxxxxxxx-wordpress.xxxxxxxxx_posts' doesn't exist f\xc3\xbcr die Abfrage SHOW FULL COLUMNS FROM `xxxxxxxxx_posts` durch edit_post, wp_update_post, wp_insert_post, referer: http://xxxxxxxx.xxx/wp-admin/post.php?post=168&action=edit
[Sun Nov 30 16:38:51.116315 2014] [:error] [pid 2911] [client 127.0.0.1:39768] WordPress-Datenbankfehler Table 'xxxxxxxxxx-wordpress.xxxxxxxxx_posts' doesn't exist f\xc3\xbcr die Abfrage SHOW FULL COLUMNS FROM `xxxxxxxxx_posts` durch edit_post, referer: http://xxxxxxxx.xxx/wp-admin/post.php?post=168&action=edit
[Sun Nov 30 16:38:51.117712 2014] [:error] [pid 2911] [client 127.0.0.1:39768] PHP Warning:  mb_check_encoding() expects parameter 1 to be string, object given in /home/.../wp-includes/wp-db.php on line 2327, referer: http://xxxxxxxx.xxx/wp-admin/post.php?post=168&action=edit
[Sun Nov 30 16:38:51.118108 2014] [:error] [pid 2911] [client 127.0.0.1:39768] WordPress-Datenbankfehler Table 'xxxxxxxxxx-wordpress.xxxxxxxxx_posts' doesn't exist f\xc3\xbcr die Abfrage SHOW FULL COLUMNS FROM `xxxxxxxxx_posts` durch edit_post, wp_update_post, wp_insert_post, referer: http://xxxxxxxx.xxx/wp-admin/post.php?post=168&action=edit

#6 @matze310706
10 years ago

I've updated to revision 30647.

Did anyone notice a problem with writing a post? Yesterday I've tried to write something but the editor was empty after saving as if it was not saved. This problem is gone now. But maybe it's related to my problem here?

It still exists, strange thing: I've written a little post which I was able to edit. But that one from yesterday and older posts are still not editable.

#7 @pento
10 years ago

Thanks for the extra information! Just to confirm, does the xxxxxxxxx_posts table exist in your database?

Also, do you have any DB drop-ins on your site? You can check by looking for a file called db.php at the base of your wp-content directory.

#8 @matze310706
10 years ago

Interesting.

To answer your question: No, there is no 'db.php' file. And yes, the 'xxxxxxxxx_posts' entry should refer to my posts table.
I say 'should' because I've seen a difference there. My database prefix looks like 'jUstA5ampL3'. It's not the real one but you get the idea, right? It's a mixture of numbers and lower case and upper case characters. But in the log all characters are just lower case characters.

If the database methods and functions are case-sensitive, which I don't know to be honest, this would explain why the posts table cannot be found. But I know that I didn't change my prefix or any other part of my database tables.

Does that help?

#10 @johnbillion
10 years ago

Actually it's lowercased in wpdb::get_col_charset() too.

Pento, what's the reason for lowercasing the column and table names?

#11 @pento
10 years ago

It's so that, for non-case sensitive MySQL servers, wpdb::table_charset will always have consistent keys.

I'll shuffle those bits around so it does a lower case lookup on the array, but sends the correct case to MySQL.

#12 @pento
10 years ago

  • Owner set to pento
  • Resolution set to fixed
  • Status changed from new to closed

In 30699:

WPDB: When looking up the character set for a table or column, make sure we send the table name to MySQL in the correct case, as MySQL can be configured with case sensitive table names.

Fixes #30538.

#13 @pento
10 years ago

Thanks for helping us track this down, @matze310706!

Please let us know if you run into any other bugs. :-)

Note: See TracTickets for help on using tickets.