Re: Zend API: Correct way to terminate entire request from within function

From: Date: Fri, 02 Jul 2004 13:47:40 +0000
Subject: Re: Zend API: Correct way to terminate entire request from within function
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-10870@lists.php.net to get a copy of this message
--- Wez Furlong <kingwez@gmail.com> wrote: > Looking at the opcode handler for exit, it looks > like you can call > zend_bailout() to terminate the request. > > Note that since exit is an opcode and not a > function, > call_user_function won't work. Thank you very much. A similar thought occurred to me (the fact that the manual refers to die/exit as keywords and not functions) shortly after writing the earlier mail. Since this morning's letter, I chased down the php die and exit keywords to the (f)lex and yacc/bison files. There they turned into the T_EXIT define which turned into a number 297 (the opcode?). This translated in the language parser yacc file to a call to the internal zend_do_exit() function. This function takes two znode pointers, and pulls a pointer to the next zend_op struct from the active_op_array. It populates the zend_op struct with information from one of the znode pointers, fills one of the members with the ZEND_EXIT opcode, fills other znode with some other information and then returns. I'm guessing that this population then triggers the exit as the next active_op_array is read. It was around then that I was becoming thoroughly confused figuring out how to call this function directly. zend_bailout() is a macro defined to equate to: _zend_bailout(__FILE__, __LINE__) Am I right in assuming that the __FILE__ and __LINE__ macros would therefore be filled automatically, and that this is all that's necessary? If so: Many thanks once again. Will try it this afternoon. Cris ___________________________________________________________ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com

« previous php.internals (#10870) next »