Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2014
    Location
    ohio
    Posts
    216
    Plugin Contributions
    0

    Default Cannot modify header information - headers already sent by ,,,

    I've been getting the following warning in the logs, think I might have only partially installed fedex shipping, not sure



    01-Oct-2015 00:27:29 America/Phoenix] PHP Warning: Cannot modify header information - headers already sent by (output started at ***/store/includes/modules/shipping/fedexwebservices.php:515) in ***/store/includes/functions/functions_general.php on line 45

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Cannot modify header information - headers already sent by ,,,

    Yep, you've got something being output on line 515 of that fedex file.

    Ref http://www.zen-cart.com/content.php?...s-already-sent
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2014
    Location
    ohio
    Posts
    216
    Plugin Contributions
    0

    Default Re: Cannot modify header information - headers already sent by ,,,

    Ok,,,

    1) how do I find line 515, are comment lines counted as lines?
    2) see below

    Common Cause:
    This warning is often caused by a blank space or extra line at the beginning or end of a .php file.
    Check the error for the filename that generated the error (ie: the "output started at...." filename), open that file in your text editor and remove the extra spaces or lines immediately before the first <?php marks in the file, or after the closing ?>


    the fedex code has no ?> anywhere in the code


    and then there's ,,

    Remember, if your language is in UTF8, then you MUST encode the file as "UTF8-without-BOM", else the BOM (byte-order-mark, an invisible character at the beginning of the file) will cause this same headers-already-sent error.

    I save in either wordpad or notepad
    Last edited by mespe; 1 Oct 2015 at 09:36 PM.

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

    Default Re: Cannot modify header information - headers already sent by ,,,

    There's also the possibility that there is something like an echo command or other command that provides output to the page... Considering that you are using v151, it may actually be a line above that where the issue is at because if I remember correctly ZC 1.5.1 error reporting tended to add 1 to the line number... As for saving with either wordpad or notepad it is important to know/recognize the difference as wordpad is word but "smaller" and could modify data associated... Better to use a more plain plain text editor... Suggestion often is notepad++ but there are others identified in the FAQ
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Sep 2014
    Location
    ohio
    Posts
    216
    Plugin Contributions
    0

    Default Re: Cannot modify header information - headers already sent by ,,,

    I downloaded notepad++ and glad to see the line numbers, this will be very helpful to someone who knows nothing about what they're doing.

    line 515 of fedex is

    echo '<!-- ' . $this->fedex_shipping_weight . ' ' . $this->fedex_shipping_num_boxes . ' -->';

    so I'm still in the dark.

    line 514 =

    case (2):

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

    Default Re: Cannot modify header information - headers already sent by ,,,

    Quote Originally Posted by mespe View Post
    I downloaded notepad++ and glad to see the line numbers, this will be very helpful to someone who knows nothing about what they're doing.

    line 515 of fedex is

    echo '<!-- ' . $this->fedex_shipping_weight . ' ' . $this->fedex_shipping_num_boxes . ' -->';

    so I'm still in the dark.

    line 514 =

    case (2):
    On that line but at the beginning add // as below:
    Code:
    // echo '<!-- ' . $this->fedex_shipping_weight . ' ' . $this->fedex_shipping_num_boxes . ' -->';
    Try again and check the error logs to see if anything else is wrong. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Cannot modify header information - headers already sent by ,,,

    Quote Originally Posted by mc12345678 View Post
    There's also the possibility that there is something like an echo command or other command that provides output to the page... Considering that you are using v151, it may actually be a line above that where the issue is at because if I remember correctly ZC 1.5.1 error reporting tended to add 1 to the line number... As for saving with either wordpad or notepad it is important to know/recognize the difference as wordpad is word but "smaller" and could modify data associated... Better to use a more plain plain text editor... Suggestion often is notepad++ but there are others identified in the FAQ
    Sorry for my above incorrect information. I just remembered that the 1 line discrepancy sometimes occurs when using the developrs tool kit. Not in a debug file. Oops.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Sep 2014
    Location
    ohio
    Posts
    216
    Plugin Contributions
    0

    Default Re: Cannot modify header information - headers already sent by ,,,

    Thanks, I commented out the line that you suggested and no error and no blank page.
    I thought it might be a good idea to provide a copy of the code that caused the error.
    Am I now going to have problems with quoting shipping costs if the buyer has two items in the cart?



    switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
    case (0):
    $show_box_weight = '';
    break;
    case (1):
    $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
    break;
    case (2):
    //echo '<!-- ' . $this->fedex_shipping_weight . ' ' . $this->fedex_shipping_num_boxes . ' -->';
    $show_box_weight = ' (' . number_format($this->fedex_shipping_weight * $this->fedex_shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
    break;
    default:
    $show_box_weight = ' (' . $this->fedex_shipping_num_boxes . ' x ' . number_format($this->fedex_shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
    break;

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

    Default Re: Cannot modify header information - headers already sent by ,,,

    Quote Originally Posted by mespe View Post
    Thanks, I commented out the line that you suggested and no error and no blank page.
    I thought it might be a good idea to provide a copy of the code that caused the error.
    Am I now going to have problems with quoting shipping costs if the buyer has two items in the cart?


    Code:
    switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
              case (0):
              $show_box_weight = '';
              break;
              case (1):
              $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
              break;
              case (2):
              //echo '<!-- ' . $this->fedex_shipping_weight . ' ' . $this->fedex_shipping_num_boxes . ' -->';
              $show_box_weight = ' (' . number_format($this->fedex_shipping_weight * $this->fedex_shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
              break;
              default:
              $show_box_weight = ' (' . $this->fedex_shipping_num_boxes . ' x ' . number_format($this->fedex_shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
              break;
    It looks like that echo command was intended to be used for troubleshooting and accidentally remained in the package from which it was downloaded. Based on the snippet of code provided there is nothing that suggests that there would be an issue/that the output was being used for anything functional in nature.

    Two suggestions, one: goto the forum thread related to the plugin (if doesn't exist go to author) to inquire about a possible newer upgrade/see if how the issue was resolved by others, and two: try the item(s) on your test/development location and see how it fairs. :)

    At the moment anything exported to the "screen" (echo) at that point of the code will result in an error, so if that data were needed for some reason, it is the wrong way/place to put it.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Cannot modify header information - headers already sent by ,,,

    Quote Originally Posted by mespe View Post
    Am I now going to have problems with quoting shipping costs if the buyer has two items in the cart?

    switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
    ...
    case (2):
    //echo '<!-- ' . $this->fedex_shipping_weight . ' ' . $this->fedex_shipping_num_boxes . ' -->';
    $show_box_weight = ' (' . number_format($this->fedex_shipping_weight * $this->fedex_shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
    No, it has nothing to do with "2 items in the cart".
    The "2" is from the setting for SHIPPING_BOX_WEIGHT_DISPLAY, which is found in your Admin, under Configuration->Shipping/Packaging->"Display Number of Boxes and Weight".

    Commenting out that line is harmless, but it does suggest either the existence of some quirks which are causing that section of code to output content prematurely, or was just leftover debug code that wasn't thoroughly tested for when the plugin author was developing it.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Cannot modify header information - headers already sent
    By billc108 in forum General Questions
    Replies: 3
    Last Post: 21 Oct 2009, 10:14 AM
  2. Cannot modify header information - headers already sent
    By Fred5550 in forum General Questions
    Replies: 2
    Last Post: 12 Feb 2009, 04:38 PM
  3. Cannot modify header information - headers already sent by
    By laserayaneh in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 6 Sep 2006, 12:14 PM
  4. Replies: 7
    Last Post: 31 Jul 2006, 06:36 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