Support » Plugin: YAK for WordPress » php error in yak-for-wordpress.php on line 1460

  • Resolved gkgkgk


    When browsing the checkout page, i am getting the following error:

    Warning: Creating default object from empty value in …\wp-content\plugins\yak-for-wordpress\yak-for-wordpress.php on line 1460

    The products table looks fine, no quantities because i am working on a downloadable products shop.
    I tried to display $_SESSION and never get a view on $_SESSION[ITEMS_NAME] wich is the argument when the function yak_get_totals(), wich containes that line 1460, is called from yak-view-cart.php (line 67).
    I’am still on localhost with that project, so i can’t provide a link to the site.
    But are there any hints, how to fix this? Does anybody have the same problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello
    Think i found a solution:

    This PHP error raises due to enabled strict mode in php error reporting.
    (ini_set(‘error_reporting’, E_ALL | E_STRICT); in php.ini)

    lines 1460 and 1461 triggered that error:
    1460 $totals->quantity = $total_qty;
    1461 $totals->price = $total_price;

    adding the explicit instantiation of $totals fixes this:
    1460 $totals = new stdClass();
    1461 $totals->quantity = $total_qty;
    1462 $totals->price = $total_price;

    maybe this finds its way in a future update release…
    BTW: thanks for this great and elegant plugin!

    Plugin Author nolongeractive


    Yeah sorry, meant to reply yesterday but then burnt hours trying to figure out how to fix all my broken tests after upgrading my test site to WP3.5 (basically any tests which rely on uploading media/images are now broken and, as far as I can tell, unfixable).

    I’ve already fixed it locally (didn’t use the stdClass route, created a custom class instead), but I won’t be releasing it until I can get my test suite working again.

    thank you for your reply and good luck with 3.5!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php error in yak-for-wordpress.php on line 1460’ is closed to new replies.