Ticket #3112 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Upload bugs

Reported by: kakingho Assigned to: 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

09/06/06 12:18:43 changed by majelbstoat

  • keywords set to bg|needs-patch.

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.

09/06/06 12:19:51 changed by majelbstoat

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

09/06/06 19:25:56 changed by ryan

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

09/08/06 14:27:14 changed by kakingho

yup! It is 2.0.1

09/08/06 14:29:30 changed by kakingho

typing mistake it is 2.0.4

09/26/06 16:12:23 changed by thinklava

  • status changed from new to closed.
  • resolution set to fixed.

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!

09/26/06 19:18:33 changed by foolswisdom

  • keywords changed from bg|needs-patch to needs-patch.
  • status changed from closed to reopened.
  • resolution deleted.

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.

11/25/06 06:29:59 changed by ryan

  • version set to 2.0.4.
  • milestone set to 2.0.6.

11/25/06 06:30:07 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

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