Req #79466 [Opn]: Fatal errors because of recursion should be exceptions

From: Date: Thu, 18 Jun 2020 20:08:19 +0000
Subject: Req #79466 [Opn]: Fatal errors because of recursion should be exceptions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227542@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79466&edit=1 ID: 79466 Updated by: nikic@php.net Reported by: david at grudl dot com Summary: Fatal errors because of recursion should be exceptions Status: Open Type: Feature/Change Request Package: Arrays related PHP Version: Next Major Version Block user comment: N Private report: N New Comment: @alexinbeijing: Non-identity comparisons already need to assume exceptions may be thrown due to overloaded comparison operators on objects. Identity comparisons may be assumed to be non-throwing currently, though there should not be that many of those. Previous Comments: ------------------------------------------------------------------------ [2020-06-18 18:27:16] alexinbeijing at gmail dot com It's nice to see that PHP already has a mechanism built in to detect a recursive traversal of an array. The interpreter fails with "nesting level too deep" when a recursive traversal is detected at zend_hash.c:2652. My concern is that if that line is changed to throw an exception, a lot of things may be affected -- there are a huge number of places in the codebase which (directly or indirectly) use this code. ------------------------------------------------------------------------ [2020-04-15 10:31:14] nikic@php.net I agree that it would be good to make this a catchable exception at least. Even better would be to not throw at all and directly support comparison of cyclic structures, but that's not easy (to do efficiently). ------------------------------------------------------------------------ [2020-04-10 21:13:18] david at grudl dot com Sorry for email in summary and wrong package! I found out that LastPass did it, it won't happen again :) ------------------------------------------------------------------------ [2020-04-10 17:10:12] bugreports at gmail dot com may i suggest that you don#t always fill your email into "summary"? [NEW]: david@grudl.com is not very helpful ------------------------------------------------------------------------ [2020-04-10 17:07:50] requinix@php.net The recursion doesn't have to be fatal: personally, I would rather have the functions warn that there was a recursive structure and then continue on. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=79466 -- Edit this bug report at https://bugs.php.net/bug.php?id=79466&edit=1

« previous php.bugs (#227542) next »