Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2012
    Location
    California
    Posts
    202
    Plugin Contributions
    0

    Default Trying to access array offset on value of type bool

    1.5.7d
    PHP 8.1
    Edit Orders 4.6.2
    TyPackage Tracker 4.0.1
    Twitch Spoon 13a

    I am getting the following warning log:
    **************************
    [29-Jun-2022 19:33:25 America/Boise] Request URI: /index.php?main_page=shopping_cart, IP address:
    #1 require(/public_html/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php) called at [/public_html/includes/modules/shipping_estimator.php:297]
    #2 require(/public_html/includes/modules/shipping_estimator.php) called at [/public_html/includes/templates/wsworx/templates/tpl_shopping_cart_default.php:204]
    #3 require(/public_html/includes/templates/wsworx/templates/tpl_shopping_cart_default.php) called at [/public_html/includes/templates/wsworx/common/tpl_main_page.php:178]
    #4 require(/public_html/includes/templates/wsworx/common/tpl_main_page.php) called at [/public_html/index.php:94]
    --> PHP Warning: Trying to access array offset on value of type bool in /public_html/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php on line 119.
    ***************************

    I have looked at the code but I cannot figure out why it is throwing this error:
    Code:
    119 if($selected_shipping['id'] == $thisquoteid){
    It is being defined earlier in the code:
    Code:
    13  if (is_array($selected_shipping)) {
    14    zen_draw_hidden_field('scid', $selected_shipping['id']);
    I am only getting the warning log after a customer completely checks out.
    Any help would be greatly appreciated.

    Thank You

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,683
    Plugin Contributions
    123

    Default Re: Trying to access array offset on value of type bool

    1.5.7 is designed to run with PHP versions up to 8.0 (not 8.1).

    https://docs.zen-cart.com/user/first...s/#php-version
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Trying to access array offset on value of type bool

    Quote Originally Posted by wsworx View Post
    1.5.7d
    PHP 8.1
    Edit Orders 4.6.2
    TyPackage Tracker 4.0.1
    Twitch Spoon 13a

    I am getting the following warning log:
    **************************
    [29-Jun-2022 19:33:25 America/Boise] Request URI: /index.php?main_page=shopping_cart, IP address:
    #1 require(/public_html/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php) called at [/public_html/includes/modules/shipping_estimator.php:297]
    #2 require(/public_html/includes/modules/shipping_estimator.php) called at [/public_html/includes/templates/wsworx/templates/tpl_shopping_cart_default.php:204]
    #3 require(/public_html/includes/templates/wsworx/templates/tpl_shopping_cart_default.php) called at [/public_html/includes/templates/wsworx/common/tpl_main_page.php:178]
    #4 require(/public_html/includes/templates/wsworx/common/tpl_main_page.php) called at [/public_html/index.php:94]
    --> PHP Warning: Trying to access array offset on value of type bool in /public_html/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php on line 119.
    ***************************

    I have looked at the code but I cannot figure out why it is throwing this error:
    Code:
    119 if($selected_shipping['id'] == $thisquoteid){
    It is being defined earlier in the code:
    Code:
    13  if (is_array($selected_shipping)) {
    14    zen_draw_hidden_field('scid', $selected_shipping['id']);
    I am only getting the warning log after a customer completely checks out.
    Any help would be greatly appreciated.

    Thank You
    There's a combination of inaccurate statement and deduction above. Hope that some additional information can clear things up a little.

    The code at lines 13 and 14 do not perform a definition. So $selected_shipping is not defined on those two lines. In fact, only during the execution of this file when the above log is being generated, line 14 doesn't get executed because $selected_shipping is not an array, but instead a boolean. Most likely it is set to false at that point, but the actual value has not been made available to us.

    Another thing too is that technically line 14 doesn't cause any change to be observed. There is no assignment, there is no output directed to anything. The omission was clearly a mistake and then issue that was being resolved needed to be corrected. But solving the issue of content for line 14 is unrelated to the problem being reported in this thread.

    Did reducing the php version down to 8.0 stop logging the issue? Can the statement about this only happening after a customer completely checks out be further/ better explained m I mean why is a customer going back through the shipping estimator if they have already purchased their product and their cart is now empty with nothing to ship to anywhere?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Cannot use string offset as an array?
    By tmccaff in forum Code Collaboration
    Replies: 6
    Last Post: 11 Feb 2018, 02:26 AM
  2. UPSXML error: Cannot use string offset as an array
    By callingrohit in forum Addon Shipping Modules
    Replies: 9
    Last Post: 16 Sep 2008, 06:23 PM
  3. Cannot use string offset as an array - error in UPSXML module
    By tat2nu in forum Addon Shipping Modules
    Replies: 5
    Last Post: 14 Aug 2008, 08:35 PM
  4. Fatal error: Cannot use string offset as an array in upsxml.php
    By yaby in forum Addon Shipping Modules
    Replies: 4
    Last Post: 19 Oct 2007, 06:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR