New Zenner
- Join Date:
- Dec 2008
- Posts:
- 22
- Plugin Contributions:
- 0
[Done v1.6.0] Timeout during final step of checkout - Solution?
After many hours of debugging this problem (session timeout error after pressing confirm button during checkout):
using lat9's notifier trace plugin and a lot of custom notifiers, I found that the error is caused when a comma or dash has been inserted into the sessionid, as it then fails these three tests in sessions.php:
Line #121 : if (preg_replace('/[a-zA-Z0-9]/', '', session_id()) != '')
Line #154 : if (preg_replace('/[a-zA-Z0-9]/', '', $tempSessid) != '')
Line #170 : if (preg_replace('/[a-zA-Z0-9]/', '', $tempName) == '') return session_name($name);
Should these regular expressions include commas and dashes? The php setup I have with dreamhost seems to include them sometimes, and I found in the php manual that they can be included in session ids: http://php.net/manual/en/function.session-id.php.
Also, I find it a little strange that zen_session_id is only called on the final step of the checkout, as using the notifier trace plugin I noticed that the sequence for checkout_process (which makes sense according to init_sessions.php) is:
zen_session_name -> makes sense called on line 34
zen_session_save_path -> makes sense called on line 35
zen_session_name -> makes sense called on line 53 or 55
zen_session_name-> makes sense called on line 54 or 56 (nested inside zen_session_id)
zen_session_id -> makes sense called on the outer of zen_session_name
(line numbers might be off since I added notifiers)
but the sequence for going from either shipping to payment or payment to confirmation is this:
zen_session_name -> makes sense called on line 34
zen_session_save_path -> makes sense called on line 35
zen_session_name
zen_session_name
but it is missing the zen_session_id call. So the two ifs must be triggering these two function calls since zen_session_id is never called:
if (isset($_POST[zen_session_name()])) {
zen_session_id($_POST[zen_session_name()]);
} elseif ( ($request_type == 'SSL') && isset($_GET[zen_session_name()]) ) {
zen_session_id($_GET[zen_session_name()]);
}
Is there a reason it is only called on checkout_process? Anyways, this is the reason that the error only occured on the final step of checkout, and why the error appeared to be random (since the session ids are generated at random). On a final note, I noticed that session_regenerate_id(); in function zen_session_recreate was sometimes adding in the commas and dashes in the session id.
Sorry for the long post, but I hope those many hours of debugging helps someone!
Kyle