一键导入
php-ext-review
Review a PHP extension module (C23 style) for correctness, memory safety, and Zend API usage. Use after implementing or modifying any src/ module.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review a PHP extension module (C23 style) for correctness, memory safety, and Zend API usage. Use after implementing or modifying any src/ module.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Comprehensive Zend Engine API reference for writing PHP 8.x extensions in C23. Covers module lifecycle, parameter parsing, zvals, zend_string, HashTable, object handlers, memory management, globals, INI settings, arginfo/stub workflow, and PHP 8 breakage traps derived from real codebase audit findings. Use whenever implementing or reviewing PHP extension C code.
Set up the ScyllaDB PHP driver for local development. Walks through installing all native dependencies, building PHP, compiling the extension, and verifying everything works. Use when onboarding or setting up a new machine.
Review CMakeLists.txt and cmake/ module files for modern CMake correctness, anti-patterns, portability bugs, and find-module issues. Use after modifying any CMake file.
Scaffold a new PHP extension module following the src/Cluster canonical pattern. Creates stub, handlers, implementation skeleton, CMakeLists.txt, and wires it into the build.
Review ScyllaDB/Cassandra C driver API usage in this extension — error handling, session/cluster lifecycle, type mapping, and async patterns. Use when touching any code that calls cass_* functions.
| name | php-ext-review |
| description | Review a PHP extension module (C23 style) for correctness, memory safety, and Zend API usage. Use after implementing or modifying any src/ module. |
| allowed-tools | Read Grep Glob |
Review the PHP extension module at $ARGUMENTS (or the most recently changed src/ files if no argument given).
Check every item below. For each finding, output: file:line — issue — fix.
static_cast, reinterpret_cast, dynamic_cast — use C casts.cpp files added — all new code must be .cbool/true/false used directly (C23 keywords, no #include <stdbool.h> needed)nullptr used for pointer null (C23 keyword) — not NULL in new code[[nodiscard]] on functions returning CassError or allocated pointerszend_object is the last field in every internal struct (required for XtOffsetOf)ZEND_PARSE_PARAMETERS_START / ZEND_PARSE_PARAMETERS_END — never zend_parse_parameters()ZEND_PARSE_PARAMETERS_NONE() for zero-parameter methodsZ_PARAM_OPTIONAL before optional Z_PARAM_* macroszend_parse_parameters_ex() or zend_parse_parameters_none_ex() callsXtOffsetOf arithmetic helper (pattern: (MyStruct *)((char *)obj - XtOffsetOf(MyStruct, zendObject)))PHP_DRIVER_GET_<TYPE>(zval_p) calls the helper — not inline everywhereZEND_THIS used instead of getThis() in new code where both workzend_string * released with zend_string_release() — never efree() or free()zend_object_release(&obj->zendObject) — not efree()ZVAL_UNDEF to mark unset zvals; Z_ISUNDEF() to test themzval_ptr_dtor() called before overwriting a live zval that may hold a referenceemalloc/efree for request-lifetime allocations; pemalloc/pefree(ptr, 1) for persistentmalloc/free except when calling external C librariesHandlers.c initialises handlers with memcpy from zend_get_std_object_handlers()handlers.offset = XtOffsetOf(MyStruct, zendObject) sethandlers.free_obj set — releases all owned resourceshandlers.get_gc set — returns table of zvals that hold PHP references (for GC)handlers.get_properties set if the object exposes readable propertieshandlers.compare set (returns 1 for different class, compares handle for same)ce->create_object assigned to the constructor function in the php_driver_define_* function*.stub.php with /** @generate-class-entries */*_arginfo.h is included inside BEGIN_EXTERN_C() / END_EXTERN_C() blockZEND_BEGIN_ARG_INFO_EX / PHP_ME / PHP_FE_END in new codethrow_invalid_argument(zval *, "param_name", "expected") — not php_error_docrefASSERT_SUCCESS(rc) used for cass_* calls that return CassError where failure is fatalrc != CASS_OK and emit E_WARNING with php_error_docrefRETURN_ZVAL(ZEND_THIS, 1, 0) — not RETURN_OBJ or manual copyRETURN_NULL() on builder methods unless intentional (breaks chaining)PHP_DRIVER_G() macro wrapper (ZTS-safe globals)Report all findings. If a section is clean, say "✓ clean". End with a one-line verdict: PASS, NEEDS FIXES (n issues), or CRITICAL (memory/crash risk).