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

$cart_details array passed in edd_complete_download_purchase hook is not unserialized #9684

Open
goncalovf opened this issue Oct 23, 2023 · 0 comments · May be fixed by #9685
Open

$cart_details array passed in edd_complete_download_purchase hook is not unserialized #9684

goncalovf opened this issue Oct 23, 2023 · 0 comments · May be fixed by #9685
Labels
type-bug workflow-needs-replication workflow-pending-triage Items that need to be triaged and reviewed before they are worked on.

Comments

@goncalovf
Copy link

Bug Report

Expected behavior

The $cart_details array passed to functions that hook into edd_complete_download_purchase (an action done in edd_complete_purchase()) should have all of its values unserialized. A few of its values aren't, though.

This is happening because edd_get_order_item_meta() is called without defining a metakey. When a metakey is not set in get_metadata() (which is called by edd_get_order_item_meta()), WordPress doesn't unserialize the data (see last portion of get_metadata_raw()).

Actual behavior

The $cart_details array passed to functions hooked into edd_complete_download_purchase should be deeply unserialized.

Steps to reproduce the behavior

  1. Hook a function that outputs the value of $cart_details into edd_complete_download_purchase and see what's outputted. You can use the following output function:
if ( ! function_exists( 'write_log' ) ) {
	function write_log( $log ) {
		if ( is_array( $log ) || is_object( $log ) ) {
			error_log( print_r( $log, true ) );
		} else {
			error_log( $log );
		}
	}
}

Information (if a specific version is affected):

EDD Version (or branch): 3.2.3

WordPress Version: 6.3.1

Any other relevant information:
Happens in the Pro plugin as well.

@goncalovf goncalovf added type-bug workflow-needs-replication workflow-pending-triage Items that need to be triaged and reviewed before they are worked on. labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug workflow-needs-replication workflow-pending-triage Items that need to be triaged and reviewed before they are worked on.
Projects
None yet
1 participant