1

In my PHP extension, how can I create an op_array with no opcodes in it?

Air
  • 8,274
  • 2
  • 53
  • 88
nc.
  • 7,179
  • 5
  • 28
  • 38

1 Answers1

1

You can use init_op_array(), declared in from zend_compile.h:

zend_op_array * op_array = emalloc(sizeof(zend_op_array));
init_op_array(op_array, type, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);

type can be ZEND_EVAL_CODE or ZEND_USER_FUNCTION.

Arnaud Le Blanc
  • 98,321
  • 23
  • 206
  • 194