Generate includes from PHP source directly#52
Generate includes from PHP source directly#52iggyvolz wants to merge 5 commits intolisachenko:masterfrom
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.
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.
| public function getGlobals(): ?CData | ||
| { | ||
| return $this->moduleEntry->globals_ptr; | ||
| if(ZEND_THREAD_SAFE) { |
There was a problem hiding this comment.
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.
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.
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
.hfiles 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).