-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add support for php7.4 #429
Add support for php7.4 #429
Conversation
There is one issue. Although the extension compiles, classes and their methods are not visible in PHP space. I've confirmed this with the Examples/CppClassesInPhp as well as my own module. I'm not sure why that is the case. I've added Php::Public to all .method() calls but since the class isn't there (as per get_declared_clases()) it doesn't really do anything. |
So it looks like some flags have changed, I'm not sure if my solution is the correct fix however I've seen other extensions doing the same with the ce_flags. Instead of assigning directly its bitwise assigned and then the classes are now visible. So either that is the fix or the ClassType constants need to be updated. There is so much different between 7.3 and 7.4 in zend_compile.h I wasn't sure what should be done. |
Looks like lots #define's for ZEND_ACC_PUBLIC etc values have changed in this commit: php/php-src@0fbd2e6#diff-bb1c0392a5de04576925c02a7c078dc1 So I'm guessing my |= (int)_type; is incorrect and what actually needs to happen is a change to classtype.h however when looking at zend_compile.h I can't 100% be sure that the numbers set there correspond to the old zend_compile.h. I think this is the last thing to solve for this to work with php 7.4. Some insight would be great. Even comments in classtype.h on how the values were calculated or what constants they were derived from would be great. |
Ok, so I've dug a bit more and found the root cause of the issue. In PHP 7.4 zend_API.c the function that registers classes there are a number of constants being or'd. In PHP 7.3 zend_API.c has fewer options being set. So perhaps my |= (int)_type; may be the appropriate solution. However its also possible that the ClassType values are updated to the combination of their value and the defaults in the zend_API.c |
why? |
I'm not sure why that is there, I've noticed it but haven't dug into it |
I have to say that for the most part this patch works except there's still an issue about the public/private/protected nature of the methods. I'm 90% sure that the ClassType.h file needs to be updated but because I don't actually know which flags were used to build it I don't really know how to fix this. Any insight would be appreciated ping @mvdwerve or @sjinks any thoughts on this? |
So I dug a bit more and it looks like I was confusing the class visibility with the method visibility. I need to look at modifiers.cpp I think. |
I confirmed with last dev src
I'm investigating why too. You got a nice direction. However, your changes works fine |
Hey @scorninpc yeah so I've re-pushed with my latest changes. It doesn't fix the issue but I think is required. I've based it off the difference of Zend/zend_compile.h in php from 7.3 to 7.4 branch. This shows that PHP changed the values for public, protected, private etc. However with this change I still get the errors. I haven't tracked the code setting the actual php visibility flag for a class method but the error message you get on the console will take you to where it is issued in the php-cpp file. I haven't had time to finish looking at that. Any additional insight/help on this would be awesome |
Thank you to start it. I'v small time too, but i'm investigating the php-src. I'v see this change on constant of visibility types, changed, but nothing to. I'll keep you alive |
The visibility modifiers for PHP 7.4 weren't applied because the PHP_VERSION_ID constant wasn't defined for files in the common target. |
@danog's patch indeed fixes the issue for me. I've incorporated it, squashed it and pushed here. Our CI now seems to work with PHP74 and the extension we wrote based off php-cpp... Merging this would be great with a new patch release. |
@gnat42 Trying to build this, however I receive many compilation errors.
I've attached a full build log here: https://pastebin.com/MGpWKVSd
|
I can't say I've ever seen an error like that in trying to get this to build against php 7.4.0. I just rebuilt php-cpp against 7.4.0 without issues. I've pasted the patch I was using and the build logs: Build Log: https://pastebin.com/0DzU9bLw |
Ping please merge |
Please, merge, we do need 7.4 support, your work is highly appreciated. |
Is this project dead? |
This project are dead by author, but people are making that work. I think someone need to create a new project to make that updated. I'm non-git user, so if anyone can to that better, i help |
This branch works very well thank you! 🙇 Perhaps a 7.4 build matrix should be added to the travis-ci.yml |
The dev is away alot time. I'm mergeing branchs here https://github.com/scorninpc/PHP-CPP until the author appears |
It is a pity that the author went into inactive, I hope he is doing well. @scorninpc I've used the fork in the extension, and everything seems to be working fine.
Could you check also #399 please? |
Man, you're awesome. Rebuilt php-tdlib with your fork. Works like a charm. |
Thank you, but i'm only a "merger" hahhhah, thanks for all community. When main dev appear I send only one pull request |
@EmielBruijntjes Any plans for a new release with this patch applied? |
Changes to match the internal changes for PHP 7.4