Cubecart Error – Warning: htmlentities() expects parameter 2

Print Friendly, PDF & Email

Just a quick note for those people who upgraded to Cubecart 4.3.9, and started to experience horrible page titles containing things like:

Warning:  htmlentities() expects parameter 2 to be long, string given in /home/user/public_html/admin/sources/products/ on line 949 etc…

There is a bug fix published by Cubecart but it isn’t terribly helpful. The problem is indeed on line 949 of /admin/sources/products/ which should read (once corrected) as follows:

<td align="left"><input name="prod_metatitle" type="text" size="35" class="textbox" value="<?php if(isset($results[0]['prod_metatitle'])) echo htmlentities($results[0]['prod_metatitle'],ENT_QUOTES,'UTF-8'); ?>" /></td>

The error in the original was quotes being put around the ENT_QUOTES constant, thus:


However, users find that once they have corrected the line as above, they still get the error message on their websites, giving away the real path to their files. This is a horrible bug, and certainly provides information you would much rather the world didn’t see.

The only way to rid your site of this error is to edit each product that was edited since the upgrade was installed. Just login to your admin area, and remove the Specific Product Meta Data >> Browser Title field from each product. Or, a quicker way of doing this is to run the following SQL against the database

UPDATE prefix_CubeCart_Inventory SET prod_metatitle = '' WHERE prod_metatitle LIKE '%htmlentities%'

Where prefix_ is your chosen table prefix when you installed CubeCart. The above assumes you don’t legitimately want any custom product titles which include the word htmlentities!

Tags: ,

One Response to “Cubecart Error – Warning: htmlentities() expects parameter 2”

  1. DonDragon October 28, 2011 at 8:04 pm #


    This should fix it.

Leave a Reply

Bot test * Time limit is exhausted. Please reload the CAPTCHA.