Jump to content

[Answered] Htmlentities Works Local, Not On Stevie


StefaanC

Recommended Posts

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 !

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...