NSArray/NSDictionary descriptionWithLocale:indent: Misdocumented

Originator:lordSaurontheGreat
Number:rdar://10765424 Date Originated:27-Jan-2012 09:16 AM
Status:Duplicate/10317358/Open Resolved:03-Feb-2012 04:26 PM
Product:Mac OS X SDK Product Version:4D502
Classification:Other Bug Reproducible:Always
 
Summary:
    NSArray and NSDictionary's documentation for descriptionWithLocale:indent: suggests that if a contained object responds to either descriptionWithLocale: or descriptionWithLocale:indent: that the output will not be sanitized, allowing the programmer to emit plist-style description strings on custom objects. This is false, since in Leopard this was changed for "security" reasons.

Steps to Reproduce:
    * Make a new custom object.
    * Implement descriptionWithLocale:indent:; ensure that this returns a string with at least one newline
    * Add an instance of this object to either an NSArray or an NSDictionary
    * NSLog the array/dictionary
    * See https://gist.github.com/1689532 for an example

Expected Results:
    The newline shouldn't be escaped! Or the documentation should be changed.

Actual Results:
    The newline is escaped, causing it to emit "\\n" instead of a literal newline.

Regression:
    ?

Notes:
    If this is not going to be fixed, then the documentation should be altered to reflect this behavior. The offending docs are:
    ( Mac OS X :: NSArray ) http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/doc/uid/20000137-BABDCIJE
    ( Mac OS X :: NSDictionary ) http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html#//apple_ref/doc/uid/20000140-CBHBHBCG
    ( iOS :: NSArray ) http://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/doc/uid/20000137-BABDCIJE
    ( iOS :: NSDictionary) http://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html#//apple_ref/doc/uid/20000140-CBHBHBCG

Comments

Duplicate of:

Duplicate of rdar://10317258 ; at least they knew...

By lordSaurontheGreat at Feb. 6, 2012, 5:20 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!