Swanfly Posted March 21, 2005 Share Posted March 21, 2005 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 More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 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 More sharing options...
Guest Posted March 21, 2005 Share Posted March 21, 2005 Can you post your code please? Link to comment Share on other sites More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 Can you post your code please? <{POST_SNAPBACK}> What part of it ? here is the line 42 in general.php return htmlspecialchars($string); Or should i paste the whole code general.php ? or checkout_confirmation.php? Link to comment Share on other sites More sharing options...
boxtel Posted March 21, 2005 Share Posted March 21, 2005 What part of it ? here is the line 42 in general.php return htmlspecialchars($string); Or should i paste the whole code general.php ? or checkout_confirmation.php? <{POST_SNAPBACK}> checkout_confirmation.php Treasurer MFC Link to comment Share on other sites More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 checkout_confirmation.php <{POST_SNAPBACK}> But its huge... over 380 lines <_< Link to comment Share on other sites More sharing options...
boxtel Posted March 21, 2005 Share Posted March 21, 2005 But its huge... over 380 lines <_< <{POST_SNAPBACK}> from the section that starts with : if (tep_not_null($order->info['comments'])) { Treasurer MFC Link to comment Share on other sites More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 from the section that starts with : if (tep_not_null($order->info['comments'])) { <{POST_SNAPBACK}> <?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 More sharing options...
boxtel Posted March 21, 2005 Share Posted March 21, 2005 <?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'); ?> <{POST_SNAPBACK}> 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 More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 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. <{POST_SNAPBACK}> No changing it wont clear the proplem. Link to comment Share on other sites More sharing options...
boxtel Posted March 21, 2005 Share Posted March 21, 2005 No changing it wont clear the proplem. <{POST_SNAPBACK}> 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 More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 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. <{POST_SNAPBACK}> 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 More sharing options...
boxtel Posted March 21, 2005 Share Posted March 21, 2005 page says this: Parse error: parse error, unexpected T_ECHO in /home/posliini/public_html/kauppa/checkout_confirmation.php on line 296 <{POST_SNAPBACK}> stupid me, without the space between <? and php <?php echo $order->info['comments']; ?> Treasurer MFC Link to comment Share on other sites More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 stupid me, without the space between <? and php <?php echo $order->info['comments']; ?> <{POST_SNAPBACK}> It is now the same it was in the beginning Link to comment Share on other sites More sharing options...
boxtel Posted March 21, 2005 Share Posted March 21, 2005 It is now the same it was in the beginning <{POST_SNAPBACK}> it does not say error on the page ? did you enter any order comments? Treasurer MFC Link to comment Share on other sites More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 it does not say error on the page ? did you enter any order comments? <{POST_SNAPBACK}> 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 More sharing options...
Swanfly Posted March 21, 2005 Author Share Posted March 21, 2005 Here is a screencapture of it... Link to comment Share on other sites More sharing options...
boxtel Posted March 22, 2005 Share Posted March 22, 2005 Here is a screencapture of it... <{POST_SNAPBACK}> 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 More sharing options...
Swanfly Posted March 22, 2005 Author Share Posted March 22, 2005 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. <{POST_SNAPBACK}> I added that. And now it looks like this: There is no error on the adress fields anymore. Link to comment Share on other sites More sharing options...
boxtel Posted March 22, 2005 Share Posted March 22, 2005 I added that. And now it looks like this: There is no error on the adress fields anymore. <{POST_SNAPBACK}> 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 More sharing options...
Swanfly Posted March 22, 2005 Author Share Posted March 22, 2005 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. <{POST_SNAPBACK}> 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 More sharing options...
Swanfly Posted March 22, 2005 Author Share Posted March 22, 2005 Here is, how it should be: Image is from another store that uses oscommerce. (my friends store) i made the red markings to show where teh adresses should be Link to comment Share on other sites More sharing options...
boxtel Posted March 22, 2005 Share Posted March 22, 2005 Here is, how it should be: Image is from another store that uses oscommerce. (my friends store) i made the red markings to show where teh adresses should be <{POST_SNAPBACK}> 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 More sharing options...
boxtel Posted March 22, 2005 Share Posted March 22, 2005 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. <{POST_SNAPBACK}> 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.