Hi all, I am developing a program analysis tool as a PHP extension. The extension makes use of the zend_set_user_opcode_handler API in order to propagate information about the variables along the execution.
I have two questions: 1. From my undestanding we can only pre-hook the execution of an opcode. In other words, we define a user_opcode_handler and after the execution of our opcode handler finish, then we can dispatch the execution to the original handler, but there is no way of taking control of the execution after the original handler is executed. Is that correct? If so, would the following way of implementing a post-hook work? - Save (by copying to another memory area) the opcode arguments. - On the next instruction executed utilize a user opcode handler for the next instruction to do the post-hook analysis by using the saved arguments. One reason I would like to use this is to propagate information after, for example, assignment operations where the result variable is not yet defined, and therefore no respective zval structure exists. Would it be possible in this case to access the newly created zval structure with the post-hook method I described above? 2. Again by what I understand from the code, userland variable names are stored in the compiled variable structure. Is there a way to access this structure given the zval pointer of the variable efficiently? Also, in a similar question, is there a way to access the userland name of a variable which is passed as an argument to a function of the extension? All I have found is how to grub the value of the variable or the respective zval structure using the argument parsing functions. Thanks, George