Advertisement:

Author Topic: SOLVED Strange php notice when changing from php 5.4 to 5.6  (Read 917 times)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
SOLVED Strange php notice when changing from php 5.4 to 5.6
« on: October 16, 2017, 02:47:52 pm »
PHP Warning:  htmlspecialchars(): charset `UTF-8;' not supported, assuming utf-8 in /oc-includes/osclass/helpers/hSanitize.php on line 155

PHP Warning:  htmlentities(): charset `UTF-8;' not supported, assuming utf-8 in /oc-includes/osclass/formatting.php on line 196

When I use php 5.6 the abode notices come up. With 5.4 they don't.

Has anyone an idea why?
I tried to change default_charset   = UTF-8; to default_charset   = utf-8;  in php.ini but no success. Is it a hosting issue?

(Not to mention that if I put php 7.0 the site stops working but this is not the mather here because I can't put it to 7.0 because other scripts from my host stop working so...).



« Last Edit: October 16, 2017, 06:49:26 pm by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Strange php notice when changing from php 5.4 to 5.6
« Reply #1 on: October 16, 2017, 03:07:06 pm »
I found here http://de.php.net/htmlspecialchars that
If omitted, the default value of the encoding varies depending on the PHP version in use. In PHP 5.6 and later, the default_charset configuration option is used as the default value. PHP 5.4 and 5.5 will use UTF-8 as the default. Earlier versions of PHP use ISO-8859-1.

Although this argument is technically optional, you are highly encouraged to specify the correct value for your code if you are using PHP 5.5 or earlier, or if your default_charset configuration option may be set incorrectly for the given input.


and

http://de2.php.net/manual/en/ini.core.php#ini.default-charset

default_charset string

    In PHP 5.6 onwards, "UTF-8" is the default value and its value is used as the default character encoding for htmlentities(), html_entity_decode() and htmlspecialchars() if the encoding parameter is omitted. The value of default_charset will also be used to set the default character set for iconv functions if the iconv.input_encoding, iconv.output_encoding and iconv.internal_encoding configuration options are unset, and for mbstring functions if the mbstring.http_input mbstring.http_output mbstring.internal_encoding configuration option is unset.

    All versions of PHP will use this value as the charset within the default Content-Type header sent by PHP if the header isn't overridden by a call to header().

    Setting default_charset to an empty value is not recommended.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Strange php notice when changing from php 5.4 to 5.6
« Reply #2 on: October 16, 2017, 05:58:24 pm »
It was set with ; in .user.ini
default_charset   = "utf-8;"
instead of
default_charset   = "utf-8"
Solved.
« Last Edit: October 16, 2017, 06:51:03 pm by marius-ciclistu »