Yoohoo-Plugins / pmpro-pdf-invoices

PMPro PDF Invoices Plugin
GNU General Public License v2.0
4 stars 3 forks source link

Fatal Error when timestamp in ms are passed instead of string time #31

Closed mircobabini closed 2 years ago

mircobabini commented 3 years ago

This is weird. I think this is coming out because of the object cache (memcached in my case).

PHP Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (1617895134) at position 8 (3): Unexpected character in /wp-content/plugins/pmpro-pdf-invoices/pmpro-pdf-invoices.php:194

mircobabini commented 3 years ago

Found it.

https://github.com/strangerstudios/paid-memberships-pro/blob/e000dec1e1406eacf7a0ce780b7ad7a79ccf11bc/services/ipnhandler.php#L795

This one does the action pmpro_added_order which calls pmpropdf_generate_pdf( $order ) with an instance of MemberOrder instead of the row $order with data from the database. In that scenario, ->timestamp is NOT a string to be passed to DateTime, it is an integer in milliseconds.

mircobabini commented 3 years ago

Yeah, ready to be fixed by PR #19.