Issues

ZF-8616: Zend_Json_Encoder does not block invalid UTF-8 as expected

Issue Type: Bug Created: 2009-12-22T15:48:17.000+0000 Last Updated: 2011-08-20T12:40:13.000+0000 Status: Open Fix version(s): Reporter: Pádraic Brady (padraic) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Json

  • zf-crteam-padraic
  • zf-crteam-priority

Related issues: - ZF-8619

Attachments:

Description

In JSON, the presence of invalid Unicode should produce an error. In the case of PHP's ext/json it instead returns NULL (presumably to avoid unnecessary errors). Zend_Json_Encoder, the PHP native implementation used either by choice or in the absence of ext/json does neither, instead pulling out what appears to be a codepoint reference. This gives rise to invalid JSON strings in that such refs are lost and presented as literal characters.

Reproduce with:

<pre class="highlight">require_once 'Zend/Json/Encoder.php';
 
$source = <<

Expected (as per ext/json):

NULL

Actual:

"ab\u005c0022"

Comments

No comments to display

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts