mircobabini/wpml-shortcodes — pull request #1 by JDGrimes (2014-09-22 20:48:52+00:00)
Title: Make sure the name is trimmed to the proper length

The `name` column in the strings database table is a `VARCHAR(160)`.
However the `icl_register_string()` function does not validate the name
passed to it. So if a `$name` longer than 160 characters is passed to
the function, it will be added to the database, but only the first 160
characters. The next time it is attempted to add it to the database,
`icl_register_string()` will check if the entry already exists by
comparing the names. The `name` field the database will be chopped off
at 160 characters, and so the two will be different. This will result
in an attempt to add the entry to the database again, which will fail
with a database error, complaining about a duplicate key on `context`
and `name`.

This scenario will happen with any string which is longer than 160
characters (after sanitization).

The fix supplied is to chop the length of the `$name` to 160 characters
in `_icl_ensure_name()`.