Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2339113-commerce-payment-transaction-use-php-time.patch | 1.55 KB | artkon |
Comments
Comment #1
artkon CreditAttribution: artkon commentedComment #2
joelpittetMoving this to needs review.
Comment #3
mglamanComment #4
mdupree CreditAttribution: mdupree commentedI 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.
Comment #5
rszrama CreditAttribution: rszrama at Centarro commentedI wonder, why is it using yet another variable here,
$current_timestamp
. It shouldn't be using time() in all places?Comment #6
liamanderson CreditAttribution: liamanderson at Acro Commerce commentedSuccessfully tested and reviewed the code in #1.
Comment #7
mglamanThat 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.
Comment #8
rszrama CreditAttribution: rszrama at Centarro commentedYou 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?
Comment #9
mglaman+1 #8. Let's update all the things. This would be great for orders.
Comment #10
rszrama CreditAttribution: rszrama at Centarro commentedComment #11
rszrama CreditAttribution: rszrama at Centarro commentedI 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.