Skip to content

skip test for bug 43130 on firebird , not relevant - #170

Merged
php-pulls merged 1 commit into
php:PHP-5.3from
mariuz:issue-43130
Aug 20, 2012
Merged

php-pulls merged 1 commit into
php:PHP-5.3from
mariuz:issue-43130

Conversation

@mariuz

@mariuz mariuz commented Aug 20, 2012

Copy link
Copy Markdown
Contributor

@travisbot

Copy link
Copy Markdown

This pull request fails (merged b9a0501 into f4054af).

@mariuz

mariuz commented Aug 20, 2012

Copy link
Copy Markdown
Contributor Author

it should be merged in 5.3 branch

@php-pulls
php-pulls merged commit b9a0501 into php:PHP-5.3 Aug 20, 2012
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
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.

4 participants