# ZEND_USER_OPCODE_CONTINUE

- Thread: https://externals.io/message/43079
- Original archive: https://news-web.php.net/php.internals/43079
- Started by johannes@php.net on 2009-02-17T20:59:03+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #43079 — johannes@php.net — 2009-02-17T20:59:03+00:00

URL: https://externals.io/message/43079#43079

Hi,

while implementing a small toy extension (see [1]) I found out that
ZEND_USER_OPCODE_CONTINUE seems to misbehave as it doesn't go to the
next opcode so I ended up in an endless loop executing the same opcode
again and again.

I'm not sure whether we should change the behavior, using a trivial
patch like the attached one or whether we should add a
ZEND_USER_OPCODE_NEXT_OPCODE constant. The first approach looks nicer to
me but might break extensions working around that problem in a hard to
track way (skipping an opcode)

Ideas, comments?

johannes

[1] http://news.php.net/php.pecl.dev/6117

---

## #43080 — Stefan Esser — 2009-02-17T21:05:48+00:00

URL: https://externals.io/message/43079#43080 · In reply to: #43079

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Johannes,

> while implementing a small toy extension (see [1]) I found out that
> ZEND_USER_OPCODE_CONTINUE seems to misbehave as it doesn't go to the
> next opcode so I ended up in an endless loop executing the same opcode
> again and again.

I guess that is exactly the required behaviour. How else do you want to
implement an user opcode that transfers control to another opline, like
a special kind of jump opcode.

Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmbJqwACgkQSuF5XhWr2njnzACgizi7a24c6GxNKTwMPU3SjvFF
KLQAnRz4w6i36ogEmT0LBofAjI5EiULP
=KDZK
-----END PGP SIGNATURE

---

## #43081 — Christian Seiler — 2009-02-17T21:12:34+00:00

URL: https://externals.io/message/43079#43081 · In reply to: #43079

Hi Johannes,

> while implementing a small toy extension (see [1]) I found out that
> ZEND_USER_OPCODE_CONTINUE seems to misbehave as it doesn't go to the
> next opcode so I ended up in an endless loop executing the same opcode
> again and again.

Isn't that expected behaviour? If a normal opcode handler does not
increase the opline, simply returning will also cause re-execution of
the same handler again and again. Why should it be different for user
opcode handlers?

Regards,
Christian

---

## #43082 — johannes@php.net — 2009-02-17T21:12:44+00:00

URL: https://externals.io/message/43079#43082 · In reply to: #43080

Stefan, 


> > […]
> 
> I guess that is exactly the required behaviour. How else do you want to
> implement an user opcode that transfers control to another opline, like
> a special kind of jump opcode.

ZEND_USER_OPCODE_DISPATCH_TO sounds like the way to do that. But we have
no clean API to set the next opcode and CONTINUE is documented as 

#define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */

talking about the "next" one - so /some/ cleanup is needed.

johannes
