-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Restore ActiveJob serialization for String subclasses without custom serializers #50122
Restore ActiveJob serialization for String subclasses without custom serializers #50122
Conversation
rails#50090 broke serialization of String subclasses that don't have serializers, like ActiveSupport::SafeBuffer. Co-authored-by: John Hawthorn <john@hawthorn.email>
4c00051
to
e57e462
Compare
This fixes serialization for String subclasses which don't have serializers. I think this will be pretty common for Possibly we could deprecate this and remove it in a future version, but we would have to do so very carefully. If we want to make a serializer for I'm also not fully convinced we should deprecate serializing string subclasses, we currently allow serializing Hash and Array subclasses, and it would probably be best to be consistent. |
Works for me. As long as they are serialized as bare strings, I have no concerns. |
Couldn't previous if statement |
… of String After changes from rails#50090 and rails#50122, a redundant if statement remains on Arguments#serialize on String related classes serialization. When adding the begin/rescue statement on the else clause the if clause began to be scoped on the rescue clause as StringSerializer is not defined and will throw SerializationError. As if clause and rescue clause share same result, the if clause started to be redundant.
@jhawthorn could this be backported? |
The bug it is fixing wasn't present on 7.1 in the first place. Unless I'm missing something? So no reason to backport it. |
So it's #50090 you want backported? |
Yeah |
Backported to 7-1-stable as 49ac7e5 |
Motivation / Background
This Pull Request has been created because #50090 broke serialization of String subclasses that don't have serializers, like ActiveSupport::SafeBuffer.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]