Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateRandomKey() breaks info table #4007

Closed
nicholashu opened this issue Mar 19, 2019 · 1 comment
Closed

generateRandomKey() breaks info table #4007

nicholashu opened this issue Mar 19, 2019 · 1 comment

Comments

@nicholashu
Copy link

Description

Using Craft::$app->security->generateRandomKey() as a setting value generated a non supported character breaking the info table. It failed to generate a base64 config string and the unserialised config was broken at the value.

Steps to reproduce

  1. run Craft::$app->plugins->savePluginSettings($this, ['key' => Craft::$app->security->generateRandomKey()] in init()

Additional info

  • Craft version: 3.1.15
  • PHP version: 7.2.6
  • Database driver & version: MySQL 5.7.12
  • Plugins & versions: custom plugin
@brandonkelly
Copy link
Member

I wasn’t able to reproduce this consistently – many strings returned by generateRandomKey() work just fine – but I could with the following string (base64-encoded):

ITcFFy6t0+k1F6FWtbrmR+IAoNG/oCHiaJfpca9F4zo=

With that (decoded), I was getting an “Incorrect string value” SQL error, because it contains a non-UTF-8 character.

Fixed for today’s release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants