Hello, A few questions :)
1) I'm trying to get an optional parameter working like the output array on exec(). That is to say, I'd like an optional parameter that doesn't need to be explicitly passed in by reference, but if it's present I want to populate it with a long value. This *should* be simple, but I can't seem to make it work without seg faulting all over :P My code looks something like this at the moment, where 'type' is the variable I'd like to fill in with a long value: ---snip--- char *foo = NULL; zval **type = NULL; int foo_len; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|/z", &foo, &foo_len, &type) == FAILURE) { WRONG_PARAM_COUNT; } -------- At this point, what code would I add if I just wanted to always set type to '15' and return from the function without doing anything else? 2) As I understand it, adding a bang (!) after the '/z' in the parameter string would mean that the parameter could be passed in with a null? What does this look like in PHP code, as I've never actually done it? Something like my_function("some string", null)? And how do I test for it in my module code? Just see if (in the above code snippet) 'type == NULL'? I ask because there will be another parameter after the long 'type' in the real function, an optional boolean value. 3) this is probably a REALLY stupid question, but I guess I'm a little uneasy about passing in char*'s zend_parse_parameters[_ex]() and not cleaning up with efree -- I assume that if I tacked on a simple 'return;' to the code snippet above, that's not going to be a memory leak or something? zend_parse_parameters[_ex]() is doing something to make this not happen? Looking through the existing modules, I notice no one else worrying, but I can't help it -- I need a word of reassurance here :) Thanks for any help! Wood Shavings! Andrew Patterson -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php