Use time() instead of REQUEST_TIME in payment transactions because app might have long running background php processes that will incorrectly have the constant from bootstrapped process.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

artkon’s picture

joelpittet’s picture

Version: 7.x-1.8 » 7.x-1.x-dev
Status: Active » Needs review

Moving this to needs review.

mglaman’s picture

Issue tags: +commerce-sprint
mdupree’s picture

I have applied the patch, reviewed the code and ran through the checkout. it is grabbing the time via time(). So far so good. Times have come in correctly on all my trial runs. Thumbs up for me, unless anyone has more tests I can run.

rszrama’s picture

I wonder, why is it using yet another variable here, $current_timestamp. It shouldn't be using time() in all places?

liamanderson’s picture

Status: Needs review » Reviewed & tested by the community

Successfully tested and reviewed the code in #1.

mglaman’s picture

I wonder, why is it using yet another variable here, $current_timestamp. It shouldn't be using time() in all places?

That way it is consistent through the one method invocation? Perhaps? Either way, PHP time() returns seconds and not microseconds, to it will probably be the same. This way it is at least properly updated for each method invoke.

rszrama’s picture

You know what, I wonder if we shouldn't generalize this patch and do the same in all of our entity controllers. Or are we maintaining payment transactions are just a special case?

mglaman’s picture

Status: Reviewed & tested by the community » Needs work

+1 #8. Let's update all the things. This would be great for orders.

rszrama’s picture

Title: Use time() instead of REQUEST_TIME for payment transaction » Use time() instead of REQUEST_TIME for Commerce entity saves
rszrama’s picture

I suppose the only thing we need to ensure is that an updated entity with revision supports always uses the same updated timestamp as its revision's created timestamp.