Skip to content

Instantly share code, notes, and snippets.

@sgolemon
Created May 15, 2014 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgolemon/c60304598499f19b7fd6 to your computer and use it in GitHub Desktop.
Save sgolemon/c60304598499f19b7fd6 to your computer and use it in GitHub Desktop.
http://us2.php.net/session_set_save_handler
"[For all callback functions] Return value is TRUE for success, FALSE for failure."
In ext/session/mod_user.c:
PS_FUNC(user) {
/* blah blah */
zval *retval = ps_call_handler(PSF(func), argc, argc);
if (retval) {
convert_to_long(retval);
return Z_LVAL_P(retval);
}
return FAILURE;
}
In Zend/zend.h:
typedef enum {
SUCCESS = 0,
FAILURE = -1,
} ZEND_RESULT_CODE;
So say you return false from that callback function. (int)false => 0, return 0 => SUCCESS!
Similiarly, return true; => return (int)true => 1, return 1 => neither SUCCESS nor FAILURE!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment