json_encode() and Generators / RFC Karma

From: Date: Fri, 30 Aug 2024 07:36:45 +0000
Subject: json_encode() and Generators / RFC Karma
Groups: php.internals 
Request: Send a blank email to internals+get-125355@lists.php.net to get a copy of this message
Hello, In the aftermath of an internal refactoring of an internal code-base to turn something eager into something more lazy using Generators, it occurred to me that while PHP refuses to serialize() a Generator, accidentally running json_encode() over a Generator produces the worst possible result: It silently encodes generators as {}. I would like to write an RFC to first deprecating and later disallowing to json_encode Generators. If you think this is a worthwhile thing to do an RFC for, I would kindly ask for somebody to grant me RFC karma, so I can start working on one. Regards Philip

« previous php.internals (#125355) next »