-
Notifications
You must be signed in to change notification settings - Fork 571
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
Jt/fix serialized values #1510
Merged
Merged
Jt/fix serialized values #1510
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… values Uses the allowed_classes option to unserialize (the options param only supported after 7.0+)
Further resolves security concerns with unserializing arbitrary data.
…fely, as well as helpers to convert json version to datetime object
…alized Updates one use of unserialize to a safe version Also cleans up the method and makes things a bit less "clever"
…2_Utils::get_datetime_from_value helper
…alized DateTime value returned from meta calls This ensures anyone using this meta value can continue to use as they were. This callback can be overridden with a field arg, $field['field_hookup_instance'][ $object_type ] - This allows disabling the shim if you already updated your use, and allows unhooking or overriding the callback Also Moves the rest of the field-specfic hooks from CMB2::field_actions to the new CMB2_Hookup_Field class.
tw2113
approved these changes
Mar 29, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looked good to me overall JT.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Update how we store/retrieve serialized values (the
text_datetime_timestamp_timezone
field).Also… bumps our min. php support to 7.4 🥳
Motivation and Context
security.
Risk Level
Testing procedure
Before this PR
Create fields (preferably in every core object type) with the
text_datetime_timestamp_timezone
field typeAnd you can test the
options-page
type with the following setup: https://gist.github.com/jtsternberg/d6ab21ca3a7de1a77d1adfefa0b9445fIn each object type, udpate the value, save, see that it all works as expected.
Check the DB values -- you should see a double-serialized
DateTime
objectTry using
get_post_meta
to retrieve the value and see that it's a serializedDateTime
object. (if you used the example above, you can see the value in thebefore_field
callback).Next
get_post_meta
value still gives you a serializedDateTime
object.wp post meta update 1 _yourprefix_demo_datetime_timestamp_timezone 'O:4:"Evil":2:{s:4:"hack";N;s:2:"me";R:2;}'