Saw the following notice in my watchdog:

message PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'parent' at row 1: INSERT INTO {browscap_statistics} (parent, counter, is_crawler) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.6; chromeframe/10.0.648.151; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; eSobiSubscriber; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; .NET CLR 1.1.4322; .NET4.0C; AskTbBLPV5/ [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 ) in browscap_exit() (line 98 of /var/www/sites/all/modules/browscap/browscap.module).


pillarsdotnet’s picture

Attached patch fixes the problem by truncating HTTP_USER_AGENT string to 255 characters.

pillarsdotnet’s picture


troybthompson’s picture

Status: Active » Reviewed & tested by the community

Confirmed that this patch fixes the same error one of my users was getting.

bernard63’s picture

I am a French Drupal beginner (sorry for my language)
I have the same problem with the Agregator module.
Is HTTP_USER_AGENT a phpmyadmin value for browscape.module, or where is it ?
I search in all direction to resolve my problem.
Thank you for a response.

Devin Carlson’s picture

The patch in #1 applies cleanly and fixes the issue of having user agent names which are longer than the maximum size allowed by the parent column (255 characters).

The issue occurs because browscap_exit successfully truncates $browser['parent'] when a default browser is not found but does not truncate $_SERVER['HTTP_USER_AGENT'] when a default browser is found.

bernard63, for issues concerning maximum data lengths and the Aggregator module, please see:

Devin Carlson’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x-1.x.

Devin Carlson’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Assigned: Unassigned » Devin Carlson
Status: Fixed » Needs review
657 bytes

Backport of #1.

Devin Carlson’s picture

Status: Needs review » Fixed

Committed to 6.x-1.x.

Status: Fixed » Closed (fixed)

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