Skip to content

Hardcoded makeLegacyMessageCode() limit #26

@matteotrubini

Description

@matteotrubini

return Str::limit(trim($messageId, $separator), 250);

is ported from
return Str::limit(trim($messageId, $separator), 250);

but it will trown an error in case of MySQL default config with varcharmax = 191 (see https://github.com/wintercms/winter/blob/ec46549b21893d39c15261aa237e49c9c0680fbb/config/database.php#L70)

I think we need to get limit value using the same logic used here:
https://github.com/wintercms/winter/blob/ec46549b21893d39c15261aa237e49c9c0680fbb/modules/system/ServiceProvider.php#L624-L642
of even better, we can check the current table schema with Schema::getConnection()->getDoctrineColumn(self::TABLE_NAME, 'code')->getLength(), but this should be tested against all supported databases to check returned values (I don't have this kind of expertise).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions