I want to build a PHP extension that can dynamically inspect every opcode generated from a PHP file and do some checking on that.
I came across several websites and found out a couple of functions like zend_set_user_opcode_handler
, but I fail to understand how this function can be used to get a complete opcode like ASSIGN !0, 50
.
I'm aware of a command like php -d vld.active=1 -d vld.execute=0 -f [filename].php
which I can use to generate PHP opcodes, but as far as I know you can only access the opcodes after the PHP program terminates.
What I'd like to get from the extension is an opcode which is obtained one-by-one (dynamically) as the function executes.
Can someone help me with this issue?
static
and available only withinzend_compile.c
, so you'd have to duplicate it. – Skivvy