PHP Magic Quote Problem with Cubecart

Dunno if you can help with this but…

Editing an Order in the Admin Area of Cubecart V4 - the onmouseover command is

<a href="javascript:toggleProdStatus(0,'Product 'Frillneck 50+ Hats' will be removed when the order is updated.','Product 'Frillneck 50+ Hats' will NOT be removed when the order is updated.','admin/images/del.gif','admin/images/no_del.gif');"><img src="admin/images/del.gif" id="del[0]" width="12" height="12" border="0" /></a>

it’s supposed to be (with backslashes)

<a href="javascript:toggleProdStatus(0,'Product \'Frillneck 50+ Hats\' will be removed when the order is updated.','Product \'Frillneck 50+ Hats\' will NOT be removed when the order is updated.','admin/images/del.gif','admin/images/no_del.gif');"><img src="admin/images/del.gif" id="del[0]" width="12" height="12" border="0" /></a>

I have another server with PHP 5.3.13 and have no problems - this server has 5.3.16 and keeps deleting the backslash and hence the Javascript doesn’t work.

The expression is

<a href="javascript:toggleProdStatus(<?php echo $i; ?>,'<?php echo sprintf($lang['admin']['orders_prod_will_be_removed'],str_replace(array("'","&#39;"),"\'",$orderInv[$i]['name']));?>','<?php echo sprintf($lang['admin']['orders_prod_wont_be_removed'],str_replace(array("'","&#39;"),"\'",$orderInv[$i]['name']));?>','<?php echo $glob['adminFolder']; ?>/images/del.gif','<?php echo $glob['adminFolder']; ?>/images/no_del.gif');"><img src="<?php echo $glob['adminFolder']; ?>/images/del.gif" id="del[<?php echo $i; ?>]" width="12" height="12" border="0" /></a>

The two php.ini’s are identical but .13 OK, .16 not.

I have tried

magic_quotes_gpc - on and off
magic_quotes_runtime - on and off
magic_quotes_sybase - on and off

Thanks in advance
Gary

The simplest thing to do would be to pull the same from from .13 and see what was changed. If you can’t do that, then look to see where $i is coming from. Offhand, i’d say str_replace(array("’","&#39;"),"’", is the culprit.

Does it change the [size=10pt]’[/size] and the [size=10pt]&[/size] to html entities ?

You could try adding another slash to see how that works out it might remove them all it might not.
You might want to try \ or \.

The string replace is looking for a quote to change to quote and so something else is striping the backslashes.

Sponsor our Newsletter | Privacy Policy | Terms of Service