-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Generate includes from PHP source directly #52
base: master
Are you sure you want to change the base?
Conversation
RUN apt update | ||
RUN apt install libffi-dev | ||
RUN docker-php-ext-install ffi | ||
RUN curl http://131.123.42.38/lmcrs/v1.0.0/srcml_1.0.0-1_ubuntu20.04.deb > srcml.deb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the official srcML download link is HTTP - https://www.srcml.org/ - not an issue at runtime unless you're regenerating the headers but it's definitely a security issue.
@@ -109,7 +109,11 @@ public function getGlobalsSize(): int | |||
*/ | |||
public function getGlobals(): ?CData | |||
{ | |||
return $this->moduleEntry->globals_ptr; | |||
if(ZEND_THREAD_SAFE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/php/php-src/blob/1c33ddb5e5598c5385c4c965992c6e031fd00dd6/Zend/zend_modules.h#L87 - not sure how to deal with this in the thread-safe case
|
||
/* disable usage of builtin instruction for strlen() */ | ||
public const COMPILE_NO_BUILTIN_STRLEN = (1 << 7); | ||
// public const COMPILE_NO_BUILTIN_STRLEN = Defines::ZEND_COMPILE_NO_BUILTIN_STRLEN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this symbol was removed in PHP 8.1 - unused in the rest of the repo
public const IS_CALLABLE = Defines::IS_CALLABLE; | ||
public const IS_ITERABLE = Defines::IS_ITERABLE; | ||
public const IS_VOID = Defines::IS_VOID; | ||
// public const IS_STATIC = Defines::IS_STATIC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These symbols were only added in 8.0 - removed to get 7.4 compatibility but they could be re-added if needed.
Wow! @iggyvolz such an amazing work! It's so pity that I have returned to my project only now, but I really would like to review and merge this PR, just need to allocate some time to check how it works ) I'm going to try to review and test this on weekend and leave my feedback. |
This PR generates the
.h
files directly from the PHP source code (committing them to the docker so as not to require a C compiler at runtime), using srcml to extract the relevant symbols. This adds support for PHP 7.4 and 8.1, as well as thread-safe versions (although 7.4 needs some work to get tests passing since the code assumes PHP 8 functionality - not sure if it's worth bothering).