Skip to content

Conversation

brettmc
Copy link
Contributor

@brettmc brettmc commented Sep 18, 2025

This pull request adds new FFI (Foreign Function Interface) wrappers and Rust-side helpers for working with PHP internals, particularly around function and execution context introspection. The changes improve the ability to interact with PHP's call stack, function flags, and class scopes from Rust code, and also provide more ergonomic and safe APIs.

New PHP internals FFI wrappers:

  • Added phper_zval_undef to set a zval to UNDEF and exposed it to Rust.
  • Added wrappers for call stack introspection: phper_get_called_scope, phper_zend_call_num_args, phper_zend_set_call_num_args, phper_zend_call_info, phper_zend_add_call_flag, and phper_zend_call_may_have_undef. Also added helpers for success/failure constants. [1] [2]

Rust-side enhancements:

  • Added is_static method to ZFunc to check if a function is static using ZEND_ACC_STATIC.
  • Improved ExecuteData::get_this and get_this_mut to use safe pointer conversion and added get_called_scope to retrieve the called class scope as an optional ClassEntry.
  • Updated module imports in phper/src/values.rs to include ClassEntry for new functionality.

@brettmc brettmc marked this pull request as draft September 18, 2025 06:47
@brettmc brettmc marked this pull request as ready for review September 21, 2025 23:40
@jmjoy jmjoy merged commit 56e0657 into phper-framework:master Sep 22, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants