unread
Trying implement empty getter/setter syntax such as:
public $Hours {
get;
set;
}
Is there any way to "inject" code into the compile process?
I'm trying via (just some proof of concept code, ignore the buffer overrun potential)
char injected_code[1024] = "";
sprintf((char*)&injected_code, "{ return $this->%s; }", Z_STRVAL(var_name->u.constant));
znode *injected_node = emalloc(sizeof(znode));
Z_STRVAL(injected_node->u.constant) = (char*)&injected_code;
Z_STRLEN(injected_node->u.constant) = strlen(injected_code);
zend_do_abstract_method(function_token, modifiers, injected_node TSRMLS_CC);
However this is causing a segfault, I'm assuming this is because I'm not initializing something of the znode properly.
How can I do this?
Thanks,
-Clint