livewire-powergrid icon indicating copy to clipboard operation
livewire-powergrid copied to clipboard

[BUG] Persist cookie name cannot feature specific characters

Open martynaskre opened this issue 9 months ago • 0 comments

⚡ PowerGrid - Pull Request

Motivation

  • [x] Bug fix
  • [ ] Enhancement
  • [ ] New feature
  • [ ] Breaking change

Description

As we can see here, the tableName property is used to construct a persist cookie name. Table name can be any string, but if the string features characters such as " " (space) or other, the following exception will be thrown:

setcookie(): Argument #1 ($name) cannot contain "=", ",", ";", " ", "\t", "\r", "\n", "\013", or "\014"

With this limitation in mind, it is logical to hash persist key using cheap hash function such as md5. In addition to added table name hashing, this PR makes getPersistKey method protected which allows end user to customise it.

Related Issue(s): None.

Documentation

This PR requires Documentation update?

  • [ ] Yes
  • [x] No
  • [ ] I have already submitted a Documentation pull request.

martynaskre avatar May 08 '24 09:05 martynaskre