[ZBX-8278] frontend-php: Use a deprecated function : mbstring.internal_encoding Created: 2014 May 29  Updated: 2017 May 30  Resolved: 2014 Jun 20

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.3
Fix Version/s: 2.2.5rc1, 2.3.2

Type: Incident report Priority: Major
Reporter: Dmitry Smirnov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: mbstring, php
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian GNU+Linux



 Description   

In SID, upgrading PHP to 5.6 leads to that warning in the Zabbix
Dashboard :

ini_set(): Use of mbstring.internal_encoding is deprecated
[dashboard.php:21 ? require_once() ? ZBase->run() ? ZBase->initLocales()
? init_mbstrings() ? ini_set() in
/usr/share/zabbix/include/locales.inc.php:25]

(Originally reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749707)



 Comments   
Comment by Pavels Jelisejevs (Inactive) [ 2014 May 30 ]

I couldn't find any mentions of mbstring.internal_encoding being deprecated in the PHP docs. We'll fix it once PHP 5.6 is released and this change is finalized.

Comment by Dmitry Smirnov [ 2014 May 31 ]

https://lmddgtfy.net/?q=mbstring.internal_encoding+deprecated

(first link) or the following page:

https://wiki.php.net/rfc/default_encoding

Comment by Pavels Jelisejevs (Inactive) [ 2014 Jun 02 ]

Thanks, we'll fix it.

Comment by Michal Belica [ 2014 Jun 08 ]

Hi, I can confirm that this also happens on Debian Jessie now. Functionality doesn't seem to be affected, but the message is shown at multiple places in the Zabbix frontend.
Is there a quick workaround, how to get rid of it? Thanks for any tips.

Comment by Oleksii Zagorskyi [ 2014 Jun 13 ]

I observed a visible issue - multiselects do not work - no suggested values.
Commenting the line resolve the issue, but that's dirty hack, use it at own risk.

It supposed to be fixed soon by devs.

Comment by Philippe Gallon [ 2014 Jun 13 ]

Hi,
I propose this procedure on debian/jessie

  • file : /usr/share/zabbix/include/locales.inc.php
    comment line 25 :
    //ini_set('mbstring.internal_encoding', 'UTF-8');
  • file : /etc/php5/apache2/php.ini
    uncomment and set UTF-8 :
    mbstring.internal_encoding = UTF-8

it seems ok !

Comment by Michal Belica [ 2014 Jun 15 ]

The workaround proposed by Oleksiy and Philippe seems to work. Thank you.
Looking forward to an officially released fix.

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 19 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-8278 r46701.

(At least, it works fine on local debian 8 vagrant box - https://downloads.sourceforge.net/project/vagrantboxjessie/debian80.box)

Comment by Oleg Egorov (Inactive) [ 2014 Jun 20 ]

(2)

// this may be needed after PHP5.6 is fully released
// ini_set('php.internal_encoding', 'UTF-8');
// $res &= (ini_get('php.internal_encoding') == 'UTF-8');

Comment is unnecessary, remove it

andrewtch I disagree. We should mention that php.internal_encoding may need modifications after PHP5.6 is released.

oleg.egorov It isn't our practice, you write "PHP deprecated usage of mbstring.internal_encoding starting from 5.6, see ZBX-8278"
This message enough and in Jira just add information about:

ini_set('php.internal_encoding', 'UTF-8');
$res &= (ini_get('php.internal_encoding') == 'UTF-8');

And why this code is needed.

andrewtch RESOLVED.

oleg.egorov CLOSED

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 20 ]

In the future we may need to add

ini_set('php.internal_encoding', 'UTF-8');
$res &= (ini_get('php.internal_encoding') == 'UTF-8');

depending on what will happen with PHP 5.6

Comment by Oleg Egorov (Inactive) [ 2014 Jun 25 ]

TESTED

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 26 ]

CLOSED. Fixed in pre-2.2.5rc1 r46852, pre-2.3.2 r46853.

Comment by Denis Legostaev [ 2014 Jul 04 ]

Zabbix Revision: 47048
PHP Version: 5.6.0~rc1+dfsg-1

I see:

ini_set(): Use of mbstring.internal_encoding is deprecated [dashboard.php:145 → make_latest_issues() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJSON->encode() → ini_set() in /var/www/zabbix/include/classes/class.cjson.php:137]

on dashboard.php

changing /etc/php5/apache2/php.ini as suggested didn't help.

commenting 161 and 137 lines in class.cjson.php helped, but I don't know if all functions are still working as intended.

Comment by Oleksii Zagorskyi [ 2014 Jul 04 ]

Denis, something wrong with your "installation".
Make sure you are not using previous frontend version.

Comment by Denis Legostaev [ 2014 Jul 04 ]

just checked, frontend is also new. (deleted old and copied new from svn)

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 04 ]

Please send your php and apache verions, thank you.

Comment by Denis Legostaev [ 2014 Jul 04 ]

php5 -v:

PHP 5.6.0RC1 (cli) (built: Jun 23 2014 12:58:14)

aptitude show php5:

Version: 5.6.0~rc1+dfsg-1

apache2 -v

Server version: Apache/2.4.9 (Debian)
Server built:   Jun  8 2014 10:01:34

aptitude show apache2

Version: 2.4.9-2
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 04 ]

Please paste output of:

shell#        php -a
php shell#    var_dump(version_compare(PHP_VERSION, '5.6')); 
Comment by Denis Legostaev [ 2014 Jul 04 ]
php -a
Interactive mode enabled

php > var_dump(version_compare(PHP_VERSION, '5.6'));
int(1)
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 04 ]

Oh. Sorry, got the idea - your PHP version is RC (release candidate), and, according to http://www.php.net/manual/en/function.version-compare.php these versions consider themselves "younger" than 5.6 (even if it says PHP5.6.0RC1).

I also would not advice you to use pre-release versions on PHP because of issues such as this.

Currently, I suggest you to set php_admin_value in apache to 22527 (E_ALL & ~E_STRICT & ~E_DEPRECATED), like:

<VirtualHost *:80>
   ....
   php_admin_value error_reporting 22527
</VirtualHost>

until PHP5.6 is out of RC.

CLOSED, WONTFIX.

Comment by michal svoboda [ 2014 Oct 03 ]

I still get this error in
include/classes/json/CJson.php

The php file does not seem to have any special version handling logic.

ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:137]
ini_set(): Use of mbstring.internal_encoding is deprecated [maps.php:149 → CView->render() → include() → getActionMapBySysmap() → CTag->setMenuPopup() → CTag->attr() → CTag->setAttribute() → CHtml::serialize() → CJs::encodeJson() → CJson->encode() → ini_set() in /srv/http/zabbix/include/classes/json/CJson.php:161]

zabbix version 2.4.0
PHP 5.6.0 (cli) (built: Sep 13 2014 10:36:37)

Comment by Oleksii Zagorskyi [ 2014 Oct 03 ]

Michal, see ZBX-8726

Generated at Thu Apr 25 04:14:31 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.