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

From: Date: Wed, 15 Apr 2020 10:31:14 +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-226585@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: 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). Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2020-04-10 16:24:20] david at grudl dot com Description: ------------ Operator === and a lot of native functions (such as in_array, array_search(), ...) can cause fatal error. Example: $foo = []; $foo[] = [ &$foo ]; array_search($foo, $foo); Problem is that this fatal error cannot be catched in try ... catch block. It would be nice if Error was thrown instead. (related to #62171) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79466&edit=1

« previous php.bugs (#226585) next »