Recent Topics

Help DB Error - browser string too long for user_browser

Started by on Mar 17, 2009 – Contents updated: Mar 17, 2009

Mar 17, 2009 20:05    

My b2evolution Version: Not Entered

Please, I need some help with this error just encountered. :(

I ran into an interesting issue while using Internet Explorer 7 on my main computer while logging into B2E.

I received the following error:

An unexpected error has occured!
If this error persits, please report it to the administrator.

Go back to home page
=================
Additional information about this error:
MySQL error!

Data too long for column 'user_browser' at row 1(Errno=1406)

Your query: DataObject::dbinsert()

INSERT INTO evo_users (user_login, user_pass, user_locale, user_email, user_level, dateYMDhour, user_allow_msgform, user_notify, user_showonline, user_nickname, user_validated, user_firstname, user_lastname, user_idmode, user_ip, user_domain, user_browser, user_grp_ID)

The browser value string was set to: (last five fields for context)

'namefl', '10.29.81.59', '10.29.81.59', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; Tablet PC 2.0; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MS-RTC LM 8)', 4)

The browser string is 225 characters. Well past the 200 characters in the column user_browser.

Any hints on how to solve this one?

What code can be modified as to how to truncate the string or change the column size?

Please help

Any assistance or suggestions would be most appreciated.

Karl

Mar 17, 2009 21:45

Great, I've never seen a so long browser name!

You can change the lenght of user_browser on database... or you can edit the file blogs/inc/sessions/model/_hit.class.php and change

PHP

return $this->user_agent;

(
in line 707 in function get_user_agent

to

PHP

return substr($this->user_agent,0,200);

Not really tested ;)

Mar 17, 2009 21:53

Hi Walter

Thanks for getting back to me.

Walter wrote:

Great, I've never seen a so long browser name!

You can change the lenght of user_browser on database... or you can edit the file blogs/inc/sessions/model/_hit.class.php and change

PHP

return $this->user_agent;

(
in line 707 in function get_user_agent

to

PHP

return substr($this->user_agent,0,200);

Not really tested ;)

I tried changing the column length to 250 by setting VARCHAR[250], but I would get an error in doing so.

I will give the substr option a whirl.

What does the team think would be the longer term architectural solution? Since I am on the ground floor, I don't want to make a change that will give problems with future upgrades to the product.

Karl

Mar 17, 2009 21:54

I'm talking with blueyed right now, will bring that issue to the team.

Mar 18, 2009 01:02

Hi karlgo,

use VARCHAR(255) not [255] if you change th DB from commandline. Else use a tool like PhpMyAdmin.
I wonder why it picked up so much detail. Either some devver has changed the code to do so and forgot the change in DB to store it or PHP has changed through the years and picked up this detail.

Do watch out, this table tends to grow huge over time if you don't prune it in time. From a structural standpoint I'd say store only what's useful so strip the info before it's stored (browser, platform).

The substr should work also.

Good luck

Mar 18, 2009 18:56

Thanks all for getting back with me.

Since I need to get things up and running, I chose to change the column length to 255 and all is well.

I'll be watching for what the long term solution is.

Thanks,

Karl


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.