-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Compile in opcache without COMPILE_IGNORE_INTERNAL_CLASSES #15025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile in opcache without COMPILE_IGNORE_INTERNAL_CLASSES #15025
Conversation
I don't believe there's a reason to compile with this flag. We don't rely on fixed addresses anyway, relying on the signatures of the symbols themselves should be fine. The same goes for file cache itself, as we don't allow loading cache files across PHP versions.
Should we check for temporary internal classes? (loaded by BTW I believe that this comment is outdated: Lines 1218 to 1221 in 6857c7c
Last time I checked, I think that this flag was added after initial namespace support landed, but before the current namespace resolution rules was implemented. |
Don't
I don't know about this comment, but I think persisting classes linked to internal ones would be unsafe for Windows, where shm can be attached to different processes, with internal symbols having different addresses. Edit: Anyway, this is not even about linking at compile time, so. |
Right, forgot that |
I think we actually need to add a check on Windows to prevent early-binding: Line 9067 in 6857c7c
Because it also relies on the |
file cache may be used after php.ini change that removes some shared extensions. |
That's true. So, I suppose we need to set this flag for both file cache and Windows then. |
because of ASLR? or because different workers may have different sets of shared extensions? |
Yes.
Honestly, I have no idea how this works on Windows. I've never developed php-src on Windows.
Before this PR, we only store references to internal classes on non-Windows with inheritance cache. Windows is explicitly disabled. php-src/Zend/zend_inheritance.c Lines 3339 to 3342 in 82479e8
Since we're already support persisting classes linked with internal classes, we may as well compile with them. For Windows, we should continue not to persist classes linked with internal classes for both internal cache and regular cache. |
953d839
to
124558e
Compare
Can this cause a BC break if the child class is defined in namespace and we have a parent class with the same name as an internal one in the same namespace but different file? |
No, as classes don't have a fallback to the global namespace. |
I don't believe there's a reason to compile with this flag. We don't rely on fixed addresses anyway, relying on the signatures of the symbols themselves should be fine.
The same goes for file cache itself, as we don't allow loading cache files across PHP versions.
Waiting for Dmitry to verify, once he's back from vacation.