Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML Parser: Invalid Character Was Found in Text Content #18

Closed
bizonix opened this issue Dec 19, 2012 · 3 comments
Closed

XML Parser: Invalid Character Was Found in Text Content #18

bizonix opened this issue Dec 19, 2012 · 3 comments
Assignees
Labels
Projects
Milestone

Comments

@bizonix
Copy link

bizonix commented Dec 19, 2012

some bug report ( PHP_VERSION: 5.3.18, LIBXML_VERSION: 20800, LIBXML_NOXMLDECL: 2)

PHP Warning: DOMDocument::loadXML(): Char 0x0 out of allowed range in Entity, line: 5892 in /private/tmp/CFPropertyList/classes/CFPropertyList/CFPropertyList.php on line 256
PHP Fatal error: Uncaught exception 'DOMException' in /private/tmp/CFPropertyList/classes/CFPropertyList/CFPropertyList.php:256

A possible solution:
preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', '', $str);

@ckruse
Copy link
Contributor

ckruse commented Dec 20, 2012

Could you paste the relevant XML?

@bizonix bizonix closed this as completed Dec 20, 2012
@bizonix bizonix reopened this Dec 20, 2012
@ckruse
Copy link
Contributor

ckruse commented Dec 20, 2012

Ok, sorry but this is not an issue of CFPropertyList. A zero byte in XML is forbidden. You have to wrap it in base64. If you want to store binary data, you should wrap it in CFData instead of CFString.

Of course we cannot simply remove characters from the XML…

@ckruse ckruse closed this as completed Dec 20, 2012
@ajsb85 ajsb85 added the invalid label Apr 18, 2018
@ajsb85 ajsb85 added this to Done in Package Apr 18, 2018
@ajsb85 ajsb85 added this to the 2.0 milestone Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Package
  
Done
Development

No branches or pull requests

5 participants