lat9 / one_page_checkout

One-Page Checkout for Zen Carts v1.5.7a and later.
GNU General Public License v2.0
15 stars 11 forks source link

PHP Warning: var_export does not handle circular references #328

Closed lat9 closed 2 years ago

lat9 commented 2 years ago

Received on initial entry for a customer's session when OPC debug is enabled:

[14-May-2022 14:42:22 Europe/Berlin] Request URI: /zc157posm/index.php?main_page=checkout_one, IP address: 127.0.0.1
#1  var_export() called at [C:\xampp\htdocs\zc157posm\includes\classes\OnePageCheckout.php:567]
#2  OnePageCheckout->startGuestOnePageCheckout() called at [C:\xampp\htdocs\zc157posm\includes\modules\pages\checkout_one\header_php.php:41]
#3  require(C:\xampp\htdocs\zc157posm\includes\modules\pages\checkout_one\header_php.php) called at [C:\xampp\htdocs\zc157posm\index.php:35]
--> PHP Warning: var_export does not handle circular references in C:\xampp\htdocs\zc157posm\includes\classes\OnePageCheckout.php on line 567.
lat9 commented 2 years ago

That last commit (although I've not seen an associated log ... yet) provides a similar change to a similar debug-output.

dbltoe commented 2 years ago

Now getting:

[15-May-2022 21:01:46 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 173.45.185.128

1 var_export() called at [/includes/classes/OnePageCheckout.php:745]

2 OnePageCheckout->updateOrderAddresses() called at [/includes/classes/observers/class.checkout_one_observer.php:422]

3 checkout_one_observer->update() called at [/includes/classes/class.base.php:118]

4 base->notify() called at [/includes/classes/order.php:425]

5 order->cart() called at [/includes/classes/order.php:35]

6 order->__construct() called at [/includes/modules/checkout_process.php:48]

7 require(/includes/modules/checkout_process.php) called at [/includes/modules/pages/checkout_process/header_php.php:14]

8 require(/includes/modules/pages/checkout_process/header_php.php) called at [/index.php:35]

--> PHP Warning: var_export does not handle circular references in /includes/classes/OnePageCheckout.php on line 745.

[15-May-2022 21:01:46 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 173.45.185.128

1 var_export() called at [/includes/classes/OnePageCheckout.php:745]

2 OnePageCheckout->updateOrderAddresses() called at [/includes/classes/observers/class.checkout_one_observer.php:422]

3 checkout_one_observer->update() called at [/includes/classes/class.base.php:118]

4 base->notify() called at [/includes/classes/order.php:425]

5 order->cart() called at [/includes/classes/order.php:35]

6 order->__construct() called at [/includes/modules/checkout_process.php:48]

7 require(/includes/modules/checkout_process.php) called at [/includes/modules/pages/checkout_process/header_php.php:14]

8 require(/includes/modules/pages/checkout_process/header_php.php) called at [/index.php:35]

--> PHP Warning: var_export does not handle circular references in /includes/classes/OnePageCheckout.php on line 745.

[15-May-2022 21:01:46 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 173.45.185.128

1 var_export() called at [/includes/classes/OnePageCheckout.php:745]

2 OnePageCheckout->updateOrderAddresses() called at [/includes/classes/observers/class.checkout_one_observer.php:422]

3 checkout_one_observer->update() called at [/includes/classes/class.base.php:118]

4 base->notify() called at [/includes/classes/order.php:425]

5 order->cart() called at [/includes/classes/order.php:35]

6 order->__construct() called at [/includes/modules/checkout_process.php:48]

7 require(/includes/modules/checkout_process.php) called at [/includes/modules/pages/checkout_process/header_php.php:14]

8 require(/includes/modules/pages/checkout_process/header_php.php) called at [/index.php:35]

--> PHP Warning: var_export does not handle circular references in /includes/classes/OnePageCheckout.php on line 745.

[15-May-2022 21:01:46 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 173.45.185.128

1 var_export() called at [/includes/classes/OnePageCheckout.php:745]

2 OnePageCheckout->updateOrderAddresses() called at [/includes/classes/observers/class.checkout_one_observer.php:422]

3 checkout_one_observer->update() called at [/includes/classes/class.base.php:118]

4 base->notify() called at [/includes/classes/order.php:425]

5 order->cart() called at [/includes/classes/order.php:35]

6 order->__construct() called at [/includes/modules/checkout_process.php:48]

7 require(/includes/modules/checkout_process.php) called at [/includes/modules/pages/checkout_process/header_php.php:14]

8 require(/includes/modules/pages/checkout_process/header_php.php) called at [/index.php:35]

--> PHP Warning: var_export does not handle circular references in /includes/classes/OnePageCheckout.php on line 745.

I will need to get the test site in sync with the main if you want to look at the actual files. Just let me know.

dbltoe commented 2 years ago

test. is set to mirror the main site for topkayakerDOTcom

lat9 commented 2 years ago

@dbltoe, did you pull that change I committed this morning? That replaces the use of var_export with the (more tolerant) print_r.

dbltoe commented 2 years ago

I have now. Will monitor.

THANX

lat9 commented 2 years ago

I'll hold off on the v2.4.1 release for a couple of days to see if any more reports 'come in'.

njcyx commented 2 years ago

I'm not sure if I changed my OnePageCheckout.php correctly by the instructions in this thread, but now I cannot visit my site. It is said HTTP ERROR 500. I uploaded the default file from v2.4.0 and my site is good. Here is the log file:

PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /includes/classes/OnePageCheckout.php on line 583.

Here is my code near line 583

public function cleanupGuestSession()
{
    if ($this->guestIsActive) {
        unset(
            $_SESSION['is_guest_checkout'],
            $_SESSION['shipping_billing'], 
            $_SESSION['billto'],
            $_SESSION['sendto']
        );
        $this->reset();
    }
}

Here is my code near line 567 unset($_SESSION['is_guest_checkout']); }

    $current_settings = print_r($this, true);
    $this->debugMessage('startGuestOnePageCheckout, exit: sendto: ' . ((isset($_SESSION['sendto'])) ? $_SESSION['sendto'] : 'not set') . ', billto: ' . ((isset($_SESSION['billto'])) ? $_SESSION['billto'] : 'not set') . PHP_EOL . $current_settings);

    if ($redirect_required) {
        zen_redirect(zen_href_link(FILENAME_CHECKOUT_ONE, '', 'SSL'));

Here is my code near line 748

public function updateOrderAddresses($order, &$taxCountryId, &$taxZoneId) { $current_settings = print_r($this, true); $this->debugMessage("updateOrderAddresses, on entry:" . var_export($order, true) . PHP_EOL . $current_settings); $this->debugMessage("Current sendto: " . ((isset($_SESSION['sendto'])) ? $_SESSION['sendto'] : 'not set')); if (zen_in_guest_checkout()) {

PHP 7.4. Zen cart 1.5.7d

njcyx commented 2 years ago

I downloaded the latest OnePageCheckout.php from the github master branch and it worked now. I tested it and no log file is generated. Thanks.

lat9 commented 2 years ago

Thanks for the come-back, @njcyx6649250!

njcyx commented 2 years ago

Sorry to bother you again, but I just placed a testing order. It went through but I received another warning log...

Enable One-Page Checkout Debug? is set to OFF.

PHP Warning: var_export does not handle circular references in /includes/classes/observers/class.checkout_one_observer.php on line 784.

Line 784 is
$hash_values = var_export($session_data, true);

I will change it to print_r and see how it works. $hash_values = print_r($session_data, true);

Update: print_r seems worked. I tried again and no log files.

lat9 commented 2 years ago

Thanks (again), @njcyx6649250 ... I'll get that changed as well.

Noting that the change in output might also affect the admin's opc_debug_redirection.php tool, mostly to remind myself!