Skip to content

Reject invalid zend_test zend_call_method calls - #25504

Open
kairosci wants to merge 1 commit into
php:masterfrom
kairosci:fix/gh-25405-zend-call-method-assert
Open

kairosci wants to merge 1 commit into
php:masterfrom
kairosci:fix/gh-25405-zend-call-method-assert

Conversation

@kairosci

@kairosci kairosci commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #25405.

The zend_test wrapper accepted a class name for an instance method and passed a null object to zend_call_method(). The method then ran without a valid $this, leading to confusing errors, engine assertions, or crashes.

Reject this invalid call in the wrapper with a ValueError before dispatch. Keep a ZEND_ASSERT in zend_call_method() as a debug-time check for extension callers that violate the C API contract. Update the existing static-return test to pass actual objects to its instance method, and add focused coverage for the invalid class-string calls, valid object calls, and valid static calls.

@kairosci
kairosci marked this pull request as draft November 16, 2026 21:53
@kairosci kairosci changed the title Add assertion for zend_call_method object Fix GH-25405: Reject invalid zend_test method calls Nov 16, 2026
@kairosci
kairosci marked this pull request as ready for review November 16, 2026 21:56
@kairosci
kairosci force-pushed the fix/gh-25405-zend-call-method-assert branch 2 times, most recently from 916fe07 to 7045637 Compare November 16, 2026 21:59
Reject class-string calls to instance methods in the zend_test wrapper before they reach zend_call_method() without an object. Retain a debug assertion for invalid C API calls and test both rejected and valid calls.

Fixes php#25405.
@kairosci
kairosci force-pushed the fix/gh-25405-zend-call-method-assert branch from 7045637 to 662199b Compare November 16, 2026 22:00
@kairosci kairosci changed the title Fix GH-25405: Reject invalid zend_test method calls Reject invalid zend_test zend_call_method calls Nov 16, 2026
@kairosci

Copy link
Copy Markdown
Contributor Author

@DanielEScherzer @Girgias as soon as you can, could you take a look at it? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with zend_test's zend_call_method()

1 participant