On 28 June 2026 14:49:18 BST, Alexander Egorov <[email protected]> wrote:

>Let's again start simple and temporarily forget about tags. We also load
>this class, either manually by including that same file, or instruct our
>autoloader for that. Now we also have this symbol in our own container:
>\Client. Despite that $client is also a \Client, its original symbol (which
>is remembered by PHP internally) is unavailable to us (like "shadowed") and
>there is no conflict. Moreover, since those are still technically the same
>class (PHP can handle that, I believe), $client instaceof \Client === true;
>And we can use this symbol throughout our main app.


No, PHP can't handle that, at least not trivially. Knowing that it was defined 
in the same file is *not* enough to prove it is the same object. 

This is in fact why OpCache only optimises and caches individual files: it has 
to take the compiled code and run a "linker" to resolve references to other 
symbols, because they might be *different* in different processes/threads.

You either have a complex key made up of every symbol the linker needed, 
recursively; or you just assume that every time you link the class you get a 
different result. 



Rowan Tommins
[IMSoP]

Reply via email to