terminal42 / contao-shortlink

Extension to create shortlinks in Contao CMS
MIT License
2 stars 5 forks source link

Change tl_terminal42_shortlink_log.browser to text #16

Closed fritzmg closed 2 years ago

fritzmg commented 2 years ago

Fixes the following error:

Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred while executing 'INSERT INTO tl_terminal42_shortlink_log (tstamp, browser, ip, pid) VALUES (?, ?, ?, ?)' with params [1648223659, "Mozilla\/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit\/605.1.15 (KHTML, like Gecko) Mobile\/15E148 LightSpeed [FBAN\/MessengerLiteForiOS;FBAV\/…;FBBV\/…;FBDV\/iPhone11,8;FBMD\/iPhone;FBSN\/iOS;FBSV\/15.4;FBSS\/2;FBCR\/;FBID\/phone;FBLC\/de;FBOP\/0]", null, 89]:  SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'browser' at row 1"

Happens when you open a shortlink from the Facebook messenger for example (causes a really long user-agent). Alternatively we could shorten the string to 255 characters in the constructor of ShortlinkLog, wdyt?

aschempp commented 2 years ago

Changing to text seems fine to me. But please use an integer value for the length, since Doctrine renamed this class in v2/v3 and that would break.

fritzmg commented 2 years ago

since Doctrine renamed this class in v2/v3

-_- they didn't even deprecate it beforehand 🙄

Anyway, changed the constant to its actual integer value.

aschempp commented 2 years ago

Thank you @fritzmg