Repository navigation
skip test for bug 43130 on firebird , not relevant - #170
Merged
Merged
Conversation
Contributor
Author
|
it should be merged in 5.3 branch |
heyJordanParker
added a commit
to heyJordanParker/php-sharp
that referenced
this pull request
Oct 12, 2026
Problem Spec section 15 says `emit` raises an event and every listener for it runs before `emit` returns. mago-sharp php#170 compiles `emit e;` to `\Sharp\Internal\emit($e);` and writes every `on` listener into `.sharp/listeners.php`, but the engine has no `Sharp\Internal\emit`, so an emitting method fails with "Call to undefined function". Solution The engine gains `Sharp\Internal\emit(object $event): void`. It finds the `.sharp/` folder above the file that declares the event's class, as the engine finds it for a source file, so an `extern event` in vendor/ finds its project's table. It reads the table once per request through `zend_compile_file`, so opcache serves it, as the constant array the file returns, without running it: code run from inside `emit` gives the caller a symbol table a tracing-JIT frame never frees. For each event class it keeps, for the request, the rows whose listed types the event is an instance of, in table order. Each listener runs on a new object of its class, created as `new` creates it, with the event when its method takes one. An exception from a listener leaves `emit`, and the listeners after it do not run. A missing or damaged table throws CompileError ".sharp/listeners.php is missing or damaged. Run vendor/bin/mago compile.". The Mago pin moves to php#170's head, so sharp/baseline/spec loses standalone-event, extern-event, extern-event-effects and emit-forms, and the §9.1 and §12 examples that Mago master already runs. Files ext/sharp/ ├── sharp.stub.php <- function Sharp\Internal\emit(object $event): void ├── sharp_arginfo.h <- regenerated: its arginfo and ext_functions ├── sharp.c <- emit, the table read, the per-request caches, │ ext_functions registered in MINIT └── sharp_unit.h <- SHARP_MAGO_COMMIT bb0566e8f, php#170's head Zend/tests/sharp/ ├── OrderEvent.sharp, OrderPaid.sharp, OrderRefunded.sharp │ <- new: an interface and two events, one per file ├── OrderNotices.sharp, Receipts.sharp, Shipping.sharp │ <- new: the listeners, a private one, one without │ a parameter, one listed twice, one on the │ interface, one on an extern event, one that │ throws, one that emits ├── Register.sharp <- new: raises both events with emit ├── harness/JobFailed.inc │ <- new: the plain PHP class the extern event marks ├── events.inc, events.phpt, events_jit_function.phpt, │ events_jit_tracing.phpt │ <- new: every listener runs before emit returns, │ in table order, once; an exception stops the │ rest; a nested emit runs first; plain PHP's │ emit and an extern event; a TypeError; a │ read-only event property └── events_table.phpt <- new: a missing or damaged table, and a gone listener class or method sharp/baseline/spec <- ten examples pass and leave the list docs/architecture/slices/15-events.md <- the table read, its refusals and the files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the test in the subject
http://gcov.php.net/viewer.php?version=PHP_5_3&func=tests&file=ext%2Fpdo_firebird%2Ftests%2Fbug_43130.phpt