Rachael w. Posted November 13, 2016 Share Posted November 13, 2016 I need some help to get this code right for an error I am getting. It's in an rss feed. Here is the error: PHP Warning: preg_replace_callback(): Requires argument 2, 'Array', to be a valid callback in rss.php on line 112 And here is the code: function strip_html_tags($str) { // $document should contain an HTML document. // This will remove HTML tags, javascript sections // and white space. It will also convert some // common HTML entities to their text equivalent. $search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript "'<[/!]*?[^<>]*?>'si", // Strip out HTML tags //"'([rn])[s]+'", // Strip out white space "'&(quot|#34);'i", // Replace HTML entities // "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'(d+);'e"); // evaluate as php $replace = array ("", "", //"\1", "\"", "&", "<", ">", " ", chr(160), chr(161), chr(162), chr(163), chr(169), "chr(\1)"); return preg_replace_callback($search, $replace, $str); } That last line above the } is line 112 which is returning the error. I've searched all day to try to figure this out and everything I've tried didn't work. Can anyone help me with this one? Link to comment Share on other sites More sharing options...
MrPhil Posted November 13, 2016 Share Posted November 13, 2016 I can see a mismatch in the number of elements in $search and $replace. Either remove the // against the & in $search, or add // against "&" in $replace. You also have an extra " " element in $replace, between > and  . Link to comment Share on other sites More sharing options...
Rachael w. Posted November 13, 2016 Author Share Posted November 13, 2016 I fixed all you noted here and no improvement. Still getting the error. I give up. Just removed the whole rss thing. Link to comment Share on other sites More sharing options...
frankl Posted November 14, 2016 Share Posted November 14, 2016 @ Would it be better to use tep_output_string or tep_output_string_protected? osCommerce user since 2003! Link to comment Share on other sites More sharing options...
Rachael w. Posted November 15, 2016 Author Share Posted November 15, 2016 I just uninstalled it. I think I was so outdated it wasn't helping much anyway. But... while I have your attention could I hit you up for assistance in another matter? I am having an issue where the shipping is not being included in the order total in checkout_confirmation.php. The order total seems to be working properly. If I put it in the cart it shows the subtotal, tax, shipping and total just as it should. The checkout_shipping has the correct rate. So, as you move through checkout everything is fine. Once you hit the confirmation the shipping disappears. Orders are placed with no shipping included. I am using a table rate, haven't changed any of that in any way. Thank you for helping me out. I spent hours trying to figure this out with no luck. Link to comment Share on other sites More sharing options...
frankl Posted November 15, 2016 Share Posted November 15, 2016 @@Rachael w. Which version of osCommerce are you running? Have you made some changes recently? Has your host made some changes to your hosting environment recently? osCommerce user since 2003! Link to comment Share on other sites More sharing options...
Rachael w. Posted November 15, 2016 Author Share Posted November 15, 2016 Yes, I upgraded the server to php 5.6. I've been going through the pages. Most of my issues were with the post, get, cookie and ereg's. I think I've found them all. I have been watching the error reports and no errors are coming up for that page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.