Jump to content

Recommended Posts

Posted

I have this line in my php code:

 

$txt = htmlentities($txt, ENT_SUBSTITUTE | ENT_HTML5 ,"ISO-8859-1");

 

On my homecomputer (using Xampp Control Panel v3.2.1) this works as espected.

On stevie I get this error (warning):

 

Warning: htmlentities() expects parameter 2 to be long, string given in...

 

What is going on and how should I resolve this?

 

Thanks !

Posted

Stevie is running PHP version 5.3.8 at the moment. The constants ENT_SUBSTITUTE and ENT_HTML5 were added in PHP version 5.4.0.

That means that stevie doesn't support them at the moment.

 

One way is to remove those constants or define them:

 

<?php
if (!defined('ENT_SUBSTITUTE')) {
   define('ENT_SUBSTITUTE', 8);
}
if (!defined('ENT_HTML5')) {
   define('ENT_HTML5', 48);
}
$txt = 'hello world <html>';
$txt = htmlentities($txt, ENT_SUBSTITUTE | ENT_HTML5 ,"ISO-8859-1");
echo $txt;
?>

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...