Re: Comments on non-unique naming convention for closures
| From: | Terry Ellison | Date: | Tue, 03 Dec 2013 09:14:12 +0000 |
| Subject: | Re: Comments on non-unique naming convention for closures | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70483@lists.php.net to get a copy of this message | ||
Stas,
I understand why you proposed content-based hash. What I was suggesting is not replacing it but amending it to produce different hash even in case same code would be encountered in different places - e.g. by hashing not only the text but also filename & line number (or counter). I'm not sure if it is strictly necessary for OPcache (could be that it is not) but in general having multiple functions with the same name floating around is not a very good idea, IMO, if we can avoid it... After all, that's how we got this problem from the start :) Yup, the scheme (in PHP speak):$mangled_name=sprintf("\0{closure}%s-%u-%x", $filename, $offset_into_file, $hash); addresses the concerns that you voice. I can't think of use cases where this would lead to false collisions. I will code up my patch on this basis. Thanks Terry