Conversation
… 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
Contributor
tw2113
left a comment
There was a problem hiding this comment.
All looked good to me overall JT.
This file contains hidden or 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
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_timezonefield).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_timezonefield typeAnd you can test the
options-pagetype 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
DateTimeobjectTry using
get_post_metato retrieve the value and see that it's a serializedDateTimeobject. (if you used the example above, you can see the value in thebefore_fieldcallback).Next
get_post_metavalue still gives you a serializedDateTimeobject.wp post meta update 1 _yourprefix_demo_datetime_timestamp_timezone 'O:4:"Evil":2:{s:4:"hack";N;s:2:"me";R:2;}'