Created
May 15, 2014 20:27
-
-
Save sgolemon/c60304598499f19b7fd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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