Edit report at https://bugs.php.net/bug.php?id=71876&edit=1
ID: 71876
User updated by: the_djmaze at hotmail dot com
Reported by: the_djmaze at hotmail dot com
Summary: Memory corruption htmlspecialchars(): charset `*'
not supported
Status: Open
Type: Bug
Package: Strings related
Operating System: Linux
PHP Version: 7.0.4
Block user comment: N
Private report: N
New Comment:
After a restart of Apache the problem is gone and not reproducible.
I understand this makes it very hard to find.
Previous Comments:
------------------------------------------------------------------------
[2016-03-22 09:12:04] the_djmaze at hotmail dot com
Added a screenshot (with a call of phpinfo() after the code)
https://dragonflycms.org/images/php-bug-htmlspecialchars.png
Fedora 22 with remi repo
$ dnf list installed | grep php
php.x86_64 7.0.4-1.fc22.remi
php-bcmath.x86_64 7.0.4-1.fc22.remi
php-cli.x86_64 7.0.4-1.fc22.remi
php-common.x86_64 7.0.4-1.fc22.remi
php-devel.x86_64 7.0.4-1.fc22.remi
php-gd.x86_64 7.0.4-1.fc22.remi
php-gmp.x86_64 7.0.4-1.fc22.remi
php-imap.x86_64 7.0.4-1.fc22.remi
php-interbase.x86_64 7.0.4-1.fc22.remi
php-json.x86_64 7.0.4-1.fc22.remi
php-mbstring.x86_64 7.0.4-1.fc22.remi
php-mcrypt.x86_64 7.0.4-1.fc22.remi
php-mysqlnd.x86_64 7.0.4-1.fc22.remi
php-pdo.x86_64 7.0.4-1.fc22.remi
php-pear.noarch 1:1.10.1-1.fc22.remi
php-pecl-apcu.x86_64 5.1.3-1.fc22.remi.7.0
php-pecl-apcu-bc.x86_64 1.0.3-1.fc22.remi.7.0
php-pecl-gmagick.x86_64 2.0.2-0.3.RC2.fc22.remi.7.0
php-pecl-igbinary.x86_64 1.2.2-0.1.20151217git2b7c703.fc22.remi.7.0
php-pecl-mailparse.x86_64 3.0.1-1.fc22.remi.7.0
php-pecl-memcache.x86_64 3.0.9-0.2.20151130gitfdbd46b.fc22.remi.7.0
php-pecl-memcached.x86_64 3.0.0-0.1.20160217git6ace07d.fc22.remi.7.0
php-pecl-msgpack.x86_64 2.0.1-1.fc22.remi.7.0
php-pecl-uuid.x86_64 1.0.4-6.fc22.remi.7.0
php-pecl-yaml.x86_64 2.0.0-0.6.RC7.fc22.remi.7.0
php-pgsql.x86_64 7.0.4-1.fc22.remi
php-process.x86_64 7.0.4-1.fc22.remi
php-soap.x86_64 7.0.4-1.fc22.remi
php-tidy.x86_64 7.0.4-1.fc22.remi
php-xml.x86_64 7.0.4-1.fc22.remi
Zend Extension 320151012
Zend Extension Build API320151012,NTS
Zend Signal Handling disabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
zend.assertions 1
zend.detect_unicode On
zend.enable_gc On
zend.multibyte Off
------------------------------------------------------------------------
[2016-03-21 23:37:40] requinix@php.net
I'm not sure why this is "memory corruption"?
https://3v4l.org/n4Qim
Which Linux? What's your configure command? Any Zend extensions installed? (Try without them.)
------------------------------------------------------------------------
[2016-03-21 23:24:35] the_djmaze at hotmail dot com
Description:
------------
Running the following code several times yields memory corruption.
Test script:
---------------
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
ini_set('log_errors',0);
class Text
{
function run()
{
eval('static::echo_data(\'test\');');
}
protected static function echo_data($data)
{
echo htmlspecialchars($data, ENT_NOQUOTES);
}
}
$test = new Text;
$test->run();
?>
Expected result:
----------------
No warning at all by using ini_get("default_charset")
Actual result:
--------------
Warning: htmlspecialchars(): charset `*' not supported
Where '*' is anything random.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71876&edit=1