fix: crash when a string is passed for the topics parameter of the mercure_publish() function by dunglas · Pull Request #2021 · php/frankenphp
Pull request overview
This PR fixes a crash that occurred when a string was passed as the topics parameter to the mercure_publish() function. The fix corrects the type handling in the Go implementation to properly extract string values from PHP's zval structures.
Key changes:
- Updated the
go_mercure_publishfunction signature to use proper C types (*C.zend_string) for string parameters - Fixed the string topic extraction from zval structures using the established pattern from the codebase
- Added comprehensive tests covering both string and array cases for the topics parameter
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mercure.go | Fixed function signature and type conversions; corrected zval string extraction for topics parameter |
| mercure_test.go | Added new test cases for mercure_publish with both module and worker modes |
| testdata/mercure-publish.php | Added test data demonstrating both string and array topic parameters |
| frankenphp_test.go | Extended test framework to support per-request options needed for Mercure hub configuration |
| testdata/flush.php | Removed extraneous blank line |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.