Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

checkout_confirmation.php error


Swanfly

Recommended Posts

I have used the oscommerce few veeks now, and it worked ok.

 

But now i have this error in my checkout_confirmation.php

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/swanfly/public_html/kauppa/includes/functions/general.php on line 42

 

Whats wrong ?

 

It worked just fine earlier.

Link to comment
Share on other sites

I have used the oscommerce few veeks now, and it worked ok.

 

But now i have this error in my checkout_confirmation.php

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/swanfly/public_html/kauppa/includes/functions/general.php on line 42

 

Whats wrong ?

 

It worked just fine earlier.

 

Could someone please help me.

Link to comment
Share on other sites

from the section that starts with :

 

  if (tep_not_null($order->info['comments'])) {

 

 

<?php
 if (tep_not_null($order->info['comments'])) {
?>
     <tr>
       <td class="main"><?php echo '<b>' . HEADING_ORDER_COMMENTS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td align="right" class="main">
<?php
 if (isset($$payment->form_action_url)) {
   $form_action_url = $$payment->form_action_url;
 } else {
   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }

 echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 if (is_array($payment_modules->modules)) {
   echo $payment_modules->process_button();
 }

 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
?>
           </td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
             </tr>
           </table></td>
         </tr>
         <tr>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_PAYMENT . '</a>'; ?></td>
           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
           <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

<?php
 if (tep_not_null($order->info['comments'])) {
?>
     <tr>
       <td class="main"><?php echo '<b>' . HEADING_ORDER_COMMENTS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td align="right" class="main">
<?php
 if (isset($$payment->form_action_url)) {
   $form_action_url = $$payment->form_action_url;
 } else {
   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }

 echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 if (is_array($payment_modules->modules)) {
   echo $payment_modules->process_button();
 }

 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
?>
           </td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
             </tr>
           </table></td>
         </tr>
         <tr>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_PAYMENT . '</a>'; ?></td>
           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
           <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

just to check if the problem is there:

 

try to change this:

 

echo nl2br(tep_output_string_protected........

 

with this :

 

echo nl2br(tep_output_string..........

 

see if the error goes, then we have not solved it but know where it is.

Treasurer MFC

Link to comment
Share on other sites

just to check if the problem is there:

 

try to change this:

 

echo nl2br(tep_output_string_protected........

 

with this :

 

echo nl2br(tep_output_string..........

 

see if the error goes, then we have not solved it but know where it is.

 

No changing it wont clear the proplem.

Link to comment
Share on other sites

No changing it wont clear the proplem.

 

 

ok, before this line:

 

<td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>

 

 

type :

 

<? php echo $order->info['comments']; ?>

 

and tell me what the page says.

Treasurer MFC

Link to comment
Share on other sites

ok, before this line:

 

                <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>

type :

 

<? php echo $order->info['comments']; ?>

 

and tell me what the page says.

 

page says this:

 

Parse error: parse error, unexpected T_ECHO in /home/posliini/public_html/kauppa/checkout_confirmation.php on line 296

Link to comment
Share on other sites

page says this:

 

Parse error: parse error, unexpected T_ECHO in /home/posliini/public_html/kauppa/checkout_confirmation.php on line 296

 

 

stupid me, without the space between <? and php

 

<?php echo $order->info['comments']; ?>

Treasurer MFC

Link to comment
Share on other sites

it does not say error on the page ?

 

did you enter any order comments?

 

It says the:

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/swanfly/public_html/kauppa/includes/functions/general.php on line 42

 

in the page there where it should be the order adress

 

And same thing in the billingadress box

 

i did not enter any ordercomments

 

Here is

Link to comment
Share on other sites

Here is a screencapture of it...

 

tilaus_error.png

 

 

ok, then it is not your comments but your addresses.

 

you could try this:

 

in general.php you see this function :

 

function tep_output_string($string, $translate = false, $protected = false) {

 

right after that add:

 

if (is_array($string)) {

$i=0;

$r='error-> ';

while ($i < sizeof($string)) {

$r .= $string[$i] . ' - ';

$i++;

}

return $r;

}

 

 

this will test if the 1st parameter (which should be a string) is in fact an array as the error message says. If it is, it will tell us what the contents of that array is on the screen. that way we can more easily determine where this is coming from.

Treasurer MFC

Link to comment
Share on other sites

ok, then it is not your comments but your addresses.

 

you could try this:

 

in general.php you see this function :

 

  function tep_output_string($string, $translate = false, $protected = false) {

 

right after that add:

 

if (is_array($string)) {

  $i=0;

  $r='error-> ';

  while ($i < sizeof($string)) {

    $r .= $string[$i] . ' - ';

    $i++;

  }

  return $r;

}

this will test if the 1st parameter (which should be a string) is in fact an array as the error message says. If it is, it will tell us what the contents of that array is on the screen. that way we can more easily determine where this is coming from.

 

I added that. And now it looks like this:

tilvahvist.png

 

There is no error on the adress fields anymore.

Link to comment
Share on other sites

I added that. And now it looks like this:

tilvahvist.png

 

There is no error on the adress fields anymore.

 

are you sure this is the same situation ?

does the page / address now looks like it should ?

 

because if the 1st parameter is an array, I would expect to see at least "error->" on that page.

Treasurer MFC

Link to comment
Share on other sites

are you sure this is the same situation ?

does the page / address now looks like it should ?

 

because if the 1st parameter is an array, I would expect to see at least "error->" on that page.

 

Yes this is the same situation.

 

But there's nothing in the adress fields, there should be the customers delivery and billing adresses on the fields.

 

:blink:

Link to comment
Share on other sites

Here is, how it should be:

 

right_way.png

 

Image is from another store that uses oscommerce. (my friends store)

 

i made the red markings to show where teh adresses should be

 

 

very strange, maybe a character set problem:

 

try to replace this :

 

function tep_output_string_protected($string) {

return tep_output_string($string, false, true);

}

 

with :

 

function tep_output_string_protected($string) {

return tep_output_string($string, false, false);

}

 

remove the code I gave you earlier.

 

see if the address is coming up.

Treasurer MFC

Link to comment
Share on other sites

very strange, maybe a character set problem:

 

try to replace this :

 

  function tep_output_string_protected($string) {

    return tep_output_string($string, false, true);

  }

 

with :

 

  function tep_output_string_protected($string) {

    return tep_output_string($string, false, false);

  }

 

remove the code I gave you earlier.

 

see if the address is coming up.

 

 

it seems to be a known reported bug :

 

 

http://www.oscommerce.com/community/bugs,1...htmlspecialchar

Treasurer MFC

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...