Just saw this entry in the watchdog for a test order and noticed the order (though completed) had no products/line items shown in it.

Looks to me like the database fields for a product/line item title are limited to 128 chars long, so the code should check title lengths and truncate if necessary before trying to insert into the database. And perhaps 128 should be bumped up.

Data too long for column 'title' at row 1 query: INSERT INTO uc_order_products (order_id, nid, title, manufacturer, model, qty, cost, price, weight, data) VALUES (60, 47824, 'Clap! Shake! Play! Sing! Creating Musical Storytimes to Encourage Emergent Literacy | Camarena Memorial Public Library - Calexico', '', 'placeholder', 1, 0, 0, 0, 'a:4:{s:17:\"uc_signup_enabled\";i:1;s:10:\"attributes\";a:1:{s:7:\"Pricing\";a:1:{i:0;s:12:\"Out of state\";}}s:9:\"shippable\";s:1:\"0\";s:6:\"module\";s:10:\"uc_product\";}') in /home/adam/projects/ip/app/drupal/includes/common.inc on line 3538.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR’s picture

The column {uc_order_products}.title is taken from {node}.title, so the schema should have been defined the same. In fact {node}.title used to be a varchar(128) back in Drupal 5 when Ubercart was first written, but was changed in Drupal 6 to be a varchar(255). I guess the Ubercart developers back then didn't get the memo, which is why {uc_order_product}.title is still at 128.

I'll create a patch to increase the size of {uc_order_products}.title to varchar(255). No sense in trying to make it longer than that because you won't be able to create a product node with a title longer than that.

adamdicarlo’s picture

Weird, but interesting story behind that. Thanks for the fast response!

TR’s picture

Status: Active » Needs review
FileSize
1.48 KB

Here's the patch. I tested it and it worked to update my D6 test site.

Status: Needs review » Needs work

The last submitted patch, 1113644.patch, failed testing.

TR’s picture

(Yeah, bot doesn't work on fixed-point branches like 6.x-2.4).

adamdicarlo’s picture

Hmm, the patch is failing to apply for me. I've tried applying to 6.x-2.4 (from the official release), and to 6.x-2.x from git.

adam@mrwalrus:~/projects/..../modules/contrib/ubercart$ patch -p0 < 1113644.patch
patching file b/uc_order/uc_order.install
Hunk #1 FAILED at 359.
Hunk #2 FAILED at 456.
Hunk #3 FAILED at 1005.
3 out of 3 hunks FAILED -- saving rejects to file b/uc_order/uc_order.install.rej

Here is the patch rerolled against both 6.x-2.4 and 6.x-2.x. The 6.x-2.4 one is a bit of a frankenstein since it includes a one-liner hook_update_N() that is in 2.x but not 2.4. Heh. This way that update won't get skipped.

Edit: Aw man, how'd this end up as comment #7? Thought it'd be #6. Oh well.

TR’s picture

Status: Needs work » Needs review

So did this change fix things for you?

I think the patch didn't apply because you have to do patch -p1 not patch -p0. A diff of the patches shows they're identical in all ways that matter.

adamdicarlo’s picture

Status: Needs review » Needs work

Just realized the product that triggered this bug was exactly 129 characters. Wow....

adamdicarlo’s picture

Status: Needs work » Reviewed & tested by the community

@TR: Oh right. Yep, the patch works for me! As far as I'm concerned, it's RTBC -- go ahead and change that if you want to find others to test it too.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1113644-6-6.x-2.x.patch, failed testing.

rfay’s picture

7.x patch in #1204374: uc_order_products and uc_order_line_items have inadequate length for 'title' fields, which has been marked a dup of this.

No wonder I didn't find this... I only looked in 7.x issues.

longwave’s picture

Version: 6.x-2.4 » 7.x-3.x-dev
Status: Needs work » Needs review
FileSize
1.6 KB

Patch for 7.x based on the 6.x patch above.

longwave’s picture

Status: Needs review » Fixed

Committed to both branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

longwave’s picture

Product titles longer than 128 could not be edited, this has been fixed in http://drupalcode.org/project/ubercart.git/commit/540093e