Bug #64912 [NEW]: Unexpected output when parsing PHP files containing NUL characters
| From: | alexander dot stehlik at gmail dot com | Date: | Thu, 23 May 2013 17:31:10 +0000 |
| Subject: | Bug #64912 [NEW]: Unexpected output when parsing PHP files containing NUL characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-179094@lists.php.net to get a copy of this message | ||
From: alexander dot stehlik at gmail dot com
Operating system: Linux (Ubuntu and CentOS)
PHP version: 5.4.15
Package: mbstring related
Bug Type: Bug
Bug description:Unexpected output when parsing PHP files containing NUL characters
Description:
------------
When this setting is used:
zend.multibyte = On
and I parse a PHP file that contains a NUL character (this one here:
http://en.wikipedia.org/wiki/Null_character)
I get some weird output.
When I do not use the mbstring.internal_encoding setting I get a lot of
question
marks (?).
When I use mbstring.internal_encoding = utf-8 I get some characters that
look
like Chinese to me.
Test script:
---------------
<?php
// I can not insert the NUL character here.
// To put it in a PHP file you can use the console:
//
// echo -e "here is \0 null" >> test.php
$var = 'here is <InsertNULCharacterHere> null';
?>
Expected result:
----------------
When I run the given example with
php test.php
I expect no output, even when this setting is active:
zend.multibyte = On
Actual result:
--------------
With the setting
zend.multibyte = On
I get some weird output (depending on the configured internal encoding):
With the setting
mbstring.internal_encoding = utf-8
I get an output that looks like this:
ã°¿ç¨çâ¶æ
²â½â§æ¡¥ç©â³æ¤ 湵汬â»à¨¿ã¸
Without the setting the output looks like this:
??????????? ?????
--
Edit bug report at https://bugs.php.net/bug.php?id=64912&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64912&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64912&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64912&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64912&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64912&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64912&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64912&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64912&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64912&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64912&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64912&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64912&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64912&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64912&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64912&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64912&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64912&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64912&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64912&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64912&r=mysqlcfg