Opened 7 years ago

Closed 6 years ago

Last modified 2 years ago

#3112 closed defect (bug) (fixed)

Upload bugs

Reported by: kakingho Owned by: anonymous
Priority: normal Milestone: 2.0.6
Component: Administration Version: 2.0.4
Severity: normal Keywords: needs-patch
Cc:

Description

I got WP 2 running.

It appears to work fine in all respects except for the image uploading.

After I press upload button,
it shows this error message

↓ (using windowXP, apache2 ,php5,mysql 5)

=========================================================

WordPress database error: [Field 'post_content_filtered' doesn't have a default value]
INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('1', '2006-09-03 07:10:00', '2006-09-03 07:10:00', 'title', 'title', , 'attachment', 'open', 'open', , 'title', , , '2006-09-03 07:10:00', '2006-09-03 07:10:00', '-1157267383', '0', 'image/gif', 'http://localhost:1/wordpress/wp-content/uploads/2006/09/icon_haha.gif')

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near at line 3]
SELECT category_id FROM wp_post2cat WHERE post_id =

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1)' at line 2]
INSERT INTO wp_post2cat (post_id, category_id) VALUES (, 1)

WordPress database error: [Out of range value adjusted for column 'post_id' at row 1]
INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES (,'_wp_attached_file','C:\Apache2\htdocs\wordpress/wp-content/uploads/2006/09/icon_haha.gif')

WordPress database error: [Out of range value adjusted for column 'post_id' at row 1]
INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES (,'_wp_attachment_metadata','a:4:{s:5:\"width\";i:18;s:6:\"height\";i:18;s:14:\"hwstring_small\";s:22:\"height=\'18\' width=\'18\'\";s:4:\"file\";s:68:\"C:\\Apache2\\htdocs\\wordpress/wp-content/uploads/2006/09/icon_haha.gif\";}')

Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2\htdocs\wordpress\wp-includes\wp-db.php:104) in C:\Apache2\htdocs\wordpress\wp-includes\pluggable-functions.php on line 272
===========================================================

I also tested WP2 at Linux

with older

PHP version 4.3.10

MySQL version 4.0.25-standard

Finally, it can upload perfectly and have "browse all" button.

*I think WP2 upload function cannot run at new stable php and mysql version.

There is difference of syntax .

Hope you can test it and fix that bug.

Thx a lot~!!

Change History (10)

  • Keywords bg|needs-patch added

I imagine this is a problem with MySQL 5 strict mode, where you have to explicitly specify a value for all columns. Adding post_content_filtered with a value of to the insert or update statements should fix it up.

Ok, so trac interprets two single quotes together as italics. Forgot about that. In any case, just add the empty string.

comment:3   ryan7 years ago

post_content_filtered should be in the insert. Are you running 2.0.4?

yup!
It is 2.0.1

typing mistake
it is 2.0.4

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

The files should have been uploaded successfully, howerver, to make it perfect, here are two solutions.
Solution A: Before u install the database, you can change the following three sentences in upgrade-schema.php in directory wp-admin:
Sentences before changed:
CREATE TABLE $wpdb->posts (
...

to_ping text NOT NULL,
pinged text NOT NULL,

...

post_content_filtered text NOT NULL,

Sentences changed to:
CREATE TABLE $wpdb->posts (
...

to_ping text NULL,
pinged text NULL,

...

post_content_filtered text NULL,

Solution B: If u have installed the Database, u can change the field "NULL" of the tuples "to_ping", "pinged" and "post_content_filtered" in table "wp_posts" from "NOT NULL" to "NULL". Of course, u can use the tools PHPMYADMIN or MYSQLCC to get it.

Hope it can help u!

  • Keywords needs-patch added; bg|needs-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

thinklava please don't mark bugs as fixed until a fix has been checked into WordPress. If you have a fix please attach it as a patch.

comment:8   ryan6 years ago

  • Milestone set to 2.0.6
  • Version set to 2.0.4

comment:9   ryan6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [4530]) Include post_content_filtered in queries to comply with MySQL strict mode. fixes #3112

Related: #17439

Note: See TracTickets for help on using tickets.