From:             fernando at consultorpc dot com
Operating system: Linux/Mac OSX Leopard
PHP version:      5.3.0
PHP Bug Type:     JSON related
Bug description:  Json_encode returns null for certain strings

Description:
------------
At my specific case, if a string contains an Euro symbol ( € ),
json_encode will return null for that string.

It might also happens with other special characters.

Reproduce code:
---------------
<?php

$array = array(
        'name' => htmlentities( 'My euro symbol €.' )
);

var_dump( $array );
var_dump( json_encode( $array ) );

Expected result:
----------------
array(1) {
  ["name"]=>
  string(29) "My euro symbol &euro;."
}
string(13) "{"name":"My euro symbol &euro;."}"

Actual result:
--------------
array(1) {
  ["name"]=>
  string(29) "My euro symbol &acirc;?&not;."
}
string(13) "{"name":null}"

-- 
Edit bug report at http://bugs.php.net/?id=49588&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49588&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49588&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49588&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49588&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49588&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49588&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49588&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49588&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49588&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49588&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49588&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49588&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49588&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49588&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49588&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49588&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49588&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49588&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49588&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49588&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49588&r=mysqlcfg

Reply via email to