Generate appsec php stub with all exposed function by extension#3858
Generate appsec php stub with all exposed function by extension#3858estringana wants to merge 2 commits intomasterfrom
Conversation
|
✨ Fix all issues with BitsAI or with Cursor
|
Benchmarks [ appsec ]Benchmark execution time: 2026-05-06 16:07:39 Comparing candidate commit 079d514 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. |
cataphract
left a comment
There was a problem hiding this comment.
I'm not against having a target to regenerate arginfo, but I think we need to do validation on the version of gen_stub.php and call it in the appropriate compatibility mode.
| ${CMAKE_CURRENT_SOURCE_DIR}/src/extension/ddappsec.stub.php | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/extension/entity_body.stub.php |
There was a problem hiding this comment.
Doesn't make sense to have one file that's specific to one compilation unit and then one named "ddappsec.stub.php". The one you created is specific to tags.c, so you can named it tags.stub.php.
| } | ||
|
|
||
| static PHP_FUNCTION(datadog_appsec_is_enabled) | ||
| PHP_FUNCTION(datadog_appsec_is_enabled) |
There was a problem hiding this comment.
but they will be references from outside
712d21e to
2cae42e
Compare
2cae42e to
8e0f7dc
Compare
db09385 to
079d514
Compare
Benchmarks [ tracer ]Benchmark execution time: 2026-05-06 16:45:45 Comparing candidate commit 079d514 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 194 metrics, 0 unstable metrics. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 079d514e06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) | ||
| list(APPEND STUB_ARGINFO_HEADERS ${_arginfo}) | ||
| endforeach() | ||
| add_custom_target(generate_arginfo DEPENDS ${STUB_ARGINFO_HEADERS}) |
There was a problem hiding this comment.
Hook stub generation into the extension build
When a stub changes, a normal cmake --build of the extension will keep compiling the checked-in *_arginfo.h because this custom target is not part of ALL and nothing depends on it; CMake's own help for add_custom_target states that, by default, nothing depends on the custom target. In the context of the new stub workflow, this means edits to tags.stub.php or entity_body.stub.php can silently ship stale reflection/function-entry metadata unless a developer remembers to build generate_arginfo manually. Add a dependency from the extension target (or otherwise list the generated headers as generated sources) so the command runs before compiling the files that include these headers.
Useful? React with 👍 / 👎.
Description
Migrate appsec extension to stub-based function registration
Replaces the scattered, hand-maintained arginfo blocks and per-file zend_function_entry tables in ddappsec.c and tags.c with the standard PHP stub workflow.
Changes
Issue where this is reported: #3855