From:             
Operating system: 
PHP version:      5.4.0RC6
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:ArrayObject should implement JsonSerializable interface

Description:
------------
PHP 5.4 brings the new JsonSerializable interface. ArrayObject already
works with json_encode as expected but does not explicitly implement this
interface.

Test script:
---------------
$ao = new ArrayObject(array('foo' => 'bar'));

var_dump(json_encode($ao));
var_dump($ao instanceof JsonSerializable);
var_dump($ao->jsonSerialize());

Expected result:
----------------
string(13) "{"foo":"bar"}"
bool(true)
string(13) "{"foo":"bar"}"

Actual result:
--------------
string(13) "{"foo":"bar"}"
bool(false)
PHP Fatal error:  Call to undefined method ArrayObject::jsonSerialize() in
- on line 6

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

Reply via email to