Bug #74909 [NEW]: XMLReader reports "Input is not proper UTF-8" on long Chinese strings
| From: | lilydjwg at gmail dot com | Date: | Wed, 12 Jul 2017 09:40:46 +0000 |
| Subject: | Bug #74909 [NEW]: XMLReader reports "Input is not proper UTF-8" on long Chinese strings | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210008@lists.php.net to get a copy of this message | ||
From: lilydjwg at gmail dot com
Operating system: Arch Linux x86_64
PHP version: 7.1.7
Package: XML Reader
Bug Type: Bug
Bug description:XMLReader reports "Input is not proper UTF-8" on long Chinese strings
Description:
------------
The error position is at the last character (\xef\xbc\x8c in UTF-8). If
I make the string longer, the position doesn't change. If I make it one
character shorter than the example, the error disappears.
I've read bug #72181 but can't reproduce that one.
My libxml2 version is 2.9.4+96+gfb56f80e-1
The XML doc for testing:
<?xml version="1.0" encoding="UTF-8"?>
<properties>
å¶é¦¬åå¯ä¸åå©ç
以å©ä¸å®¹çæ¶çå¼·å¾·ï¼æºå¤§æç¸½ç¢å¦æ°ä¸æ¯åï¼æ²ç®äººèµ·å¦ç©å°äºè©±å¤å¤å¹´è³æ§å·±å¤é åºåãå¨é¤¨æ¼éé£èª¿ä»£ä»å¦å¸¸åè¦åè°ï¼å¸åèçé¿éç´çæ£å®¶ï¼ç©è»ä¸ï¼æ¯è¯æ¯é«éè¨ç¨èªªæå
¬åª½éåç³ä¹é½æ¼æè¡ï¼ç²é©ç¨±éç¼ç¼å·¥ï¼å±¤ä¸ç±çéè¿è¦éå°å»è³çæèä¾è¨±æ¨ãç¨®å¾æµ·å¨ä¸åç¢ç¨çæ²»æä»é¢ä¸ï¼æä¸å»ºæ
ãä½ å®¤éè±â¦â¦æ¾æåï¼
</properties>
Test script:
---------------
<?php
$reader = new XMLReader();
$reader->open("a.xml");
while($reader->read()) {
}
Actual result:
--------------
PHP Warning: XMLReader::read(): /home/lilydjwg/tmp/a.xml:3: parser
error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xEF 0xBC EOF in /home/lilydjwg/.cache/tmp/a.php on line 4
PHP Warning: XMLReader::read():
å¨ä¸åç¢ç¨çæ²»æä»é¢ä¸ï¼æä¸å»ºæ
ãä½ å®¤éè±â¦â¦æ¾æå
in /home/lilydjwg/tmp/a.php on line 4
PHP Warning: XMLReader::read():
--
Edit bug report at https://bugs.php.net/bug.php?id=74909&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74909&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74909&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74909&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74909&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74909&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74909&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74909&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74909&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74909&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74909&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74909&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74909&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74909&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74909&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74909&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74909&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74909&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74909&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74909&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74909&r=mysqlcfg