Parse error: syntax error, unexpected ':' in /sites/all/modules/block_class/block_class.module on line 36

It's at the end of the line of help text "you must add print block classes to your themes block.tpl.php"

Once I got that it was a "specified key was too long" PDO error.

This has something to do with Unicode characters taking up more than a standard byte.

See also: #982980: #1071 - Specified key was too long; max key length is 1000 bytes -> kills site & possible backups wont work

Something like the following fixes it:
'primary key' => array(array('module', 128), array('delta', 128)),

It has to be shorter than 333 or so characters, because each letter of the key takes up 3 bytes. (at least on my server)

Comments

mlncn’s picture

subscribe. a fix and a release possible soon?

todd nienkerk’s picture

Title: Can't install 7.x CVS version » "Specified key was too long" error when installing 7.x-1.x-dev

Parse error: syntax error [...]

This has been fixed. Sorry about that!

Once I got that it was a "specified key was too long" PDO error.

This has something to do with Unicode characters taking up more than a standard byte.

I'm hesitant to apply the patch listed in #982980: #1071 - Specified key was too long; max key length is 1000 bytes -> kills site & possible backups wont work for a couple of reasons:

    That patch hasn't been accepted by that module, so it's not necessarily the best solution.
    Limiting the key length to 128 characters seems to conflict with the stated length of 255 characters for the module and delta fields. These fields were extended to 255 characters in a recent version of the 6.x branch of the module; shortening the field could result in data loss in some rare cases.

I'll take a deeper look today.

elliotttf’s picture

Status: Active » Needs review

The patch in #1020790: Port schema update to 7.x-1.x branch addresses this issue. Changing the key length does not reduce the amount of data that is stored, only the amount of data that is used for indexing.

elliotttf’s picture

Status: Needs review » Fixed

Committed @ http://drupal.org/cvs?commit=480696

Run update.php for the change to take effect.

Status: Fixed » Closed (fixed)

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

sgabe’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new2.45 KB
new1.98 KB

I think the solution introduced here is not correct. We should adhere to the core Block module's database scheme and set the length 64 for the module field and 32 for delta. These fields are needlessly long.

The attached patches are for DRUPAL-6--1 and DRUPAL-7--1. IMO this bug should be fixed for DRUPAL-6--1 ASAP, the module cannot be installed in the current state.

yang_yi_cn’s picture

yang_yi_cn’s picture

as I mentioned in #610010: CSS Class field is limited to 50 chars, the current dev has a bug and #6 didn't fix that, which is the field definition of "css_class" is not correct, it should be "length" instead of "size".

yang_yi_cn’s picture

StatusFileSize
new1.67 KB

Patch rolled for D6. I don't have too much experience with D7 so I cannot make one for D7. If someone can do it for D7, appreciated.

mark trapp’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.3 KB

Patch for Drupal 7 in #6 didn't apply cleanly, so I had to reroll it; it otherwise solves the problem. This should probably be fixed in the 7.x-1.x first then backported to 6.x as 7.x is the current Drupal release.

todd nienkerk’s picture

Assigned: Unassigned » mark trapp

@Mark Trapp: Thanks for the re-roll. Can you apply that patch to 7.x-1.x and reroll for 6.x-1.x?

eric.chenchao’s picture

subscribe

berenddeboer’s picture

Status: Reviewed & tested by the community » Closed (fixed)

It appears the patch has been applied everywhere I can see, so marked as closed.

sgabe’s picture

Status: Closed (fixed) » Reviewed & tested by the community

I don't know where did you see that, but this issue is still valid, you can see it in the repository.

sun’s picture

Title: "Specified key was too long" error when installing 7.x-1.x-dev » 7.x-1.x fails to install database schema ("Specified key was too long")
Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: mark trapp » Unassigned
Priority: Normal » Critical
StatusFileSize
new3.29 KB

You MUST NOT change or edit existing module update functions.

Attached patch fixes this bug properly.

#1287662: 6.x-1.x fails to install database schema fixes the same error for 6.x-1.x.

sun’s picture

Any updates? This is a critical bug.

berenddeboer’s picture

Assigned: Unassigned » berenddeboer
Status: Reviewed & tested by the community » Closed (fixed)

Patch committed.