Changed php_error to php_error_docref.

Thanks to Marcus Börger for writing a script that significantly simplifies
this process.
This commit is contained in:
Ilia Alshanetsky 2003-01-18 21:31:11 +00:00
parent b2ecf47755
commit aebb39b014
11 changed files with 181 additions and 283 deletions

View file

@ -400,8 +400,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
t->func, t->func,
retval, 2, argv TSRMLS_CC); retval, 2, argv TSRMLS_CC);
if (error == FAILURE) { if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the CURLOPT_WRITEFUNCTION");
get_active_function_name(TSRMLS_C));
length = -1; length = -1;
} }
else { else {
@ -455,8 +454,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
t->func, t->func,
retval, 3, argv TSRMLS_CC); retval, 3, argv TSRMLS_CC);
if (error == FAILURE) { if (error == FAILURE) {
php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
get_active_function_name(TSRMLS_C));
length = -1; length = -1;
} }
else { else {
@ -515,8 +513,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
t->func, t->func,
retval, 2, argv TSRMLS_CC); retval, 2, argv TSRMLS_CC);
if (error == FAILURE) { if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the CURLOPT_HEADERFUNCTION");
get_active_function_name(TSRMLS_C));
length = -1; length = -1;
} }
else { else {
@ -560,13 +557,12 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
func, func,
retval, 2, argv TSRMLS_CC); retval, 2, argv TSRMLS_CC);
if (error == FAILURE) { if (error == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_PASSWDFUNCTION", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the CURLOPT_PASSWDFUNCTION");
ret = -1; ret = -1;
} }
else { else {
if (Z_STRLEN_P(retval) > buflen) { if (Z_STRLEN_P(retval) > buflen) {
php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle");
get_active_function_name(TSRMLS_C));
ret = -1; ret = -1;
} }
else { else {
@ -687,7 +683,7 @@ PHP_FUNCTION(curl_init)
ch->cp = curl_easy_init(); ch->cp = curl_easy_init();
if (! ch->cp) { if (! ch->cp) {
php_error(E_WARNING, "%s(): Cannot initialize a new cURL handle", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot initialize a new cURL handle");
RETURN_FALSE; RETURN_FALSE;
} }
@ -924,9 +920,7 @@ PHP_FUNCTION(curl_setopt)
postfields = HASH_OF(*zvalue); postfields = HASH_OF(*zvalue);
if (! postfields) { if (! postfields) {
php_error(E_WARNING, php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
"%s(): Couldn't get HashTable in CURLOPT_POSTFIELDS",
get_active_function_name(TSRMLS_C));
RETURN_FALSE; RETURN_FALSE;
} }
@ -988,9 +982,7 @@ PHP_FUNCTION(curl_setopt)
ph = HASH_OF(*zvalue); ph = HASH_OF(*zvalue);
if (!ph) { if (!ph) {
php_error(E_WARNING, php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments");
"%s(): You must pass either an object or an array with the CURLOPT_HTTPHEADER, "
"CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments", get_active_function_name(TSRMLS_C));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1006,8 +998,7 @@ PHP_FUNCTION(curl_setopt)
slist = curl_slist_append(slist, indiv); slist = curl_slist_append(slist, indiv);
if (! slist) { if (! slist) {
efree(indiv); efree(indiv);
php_error(E_WARNING, "%s(): Couldn't build curl_slist", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't build curl_slist");
get_active_function_name(TSRMLS_C));
RETURN_FALSE; RETURN_FALSE;
} }
zend_llist_add_element(&ch->to_free.str, &indiv); zend_llist_add_element(&ch->to_free.str, &indiv);

View file

@ -108,7 +108,9 @@ PHP_MINFO_FUNCTION(cyrus)
extern void fatal(char *s, int exit) extern void fatal(char *s, int exit)
{ {
php_error(E_ERROR, s); TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_ERROR, s);
} }
/* {{{ proto resource cyrus_connect([ string host [, string port [, int flags]]]) /* {{{ proto resource cyrus_connect([ string host [, string port [, int flags]]])
@ -167,11 +169,11 @@ PHP_FUNCTION(cyrus_connect)
break; break;
case -1: case -1:
php_error(E_WARNING, "%s(): Invalid hostname: %s", get_active_function_name(TSRMLS_C), host); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid hostname: %s", host);
RETURN_FALSE; RETURN_FALSE;
case -2: case -2:
php_error(E_WARNING, "%s(): Invalid port: %d", get_active_function_name(TSRMLS_C), port); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid port: %d", port);
RETURN_FALSE; RETURN_FALSE;
} }
@ -285,7 +287,7 @@ PHP_FUNCTION(cyrus_authenticate)
if (! user) { if (! user) {
struct passwd *pwd = getpwuid(getuid()); struct passwd *pwd = getpwuid(getuid());
if (! pwd) { if (! pwd) {
php_error(E_WARNING, "%s(): Couldn't determine user id", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't determine user id");
RETURN_FALSE; RETURN_FALSE;
} }
@ -358,8 +360,7 @@ static void cyrus_generic_callback(struct imclient *client,
if (call_user_function_ex(EG(function_table), NULL, callback->function, if (call_user_function_ex(EG(function_table), NULL, callback->function,
&retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) { &retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) {
php_error(E_WARNING, "%s(): Couldn't call the %s handler", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the %s handler", callback->trigger);
get_active_function_name(TSRMLS_C), callback->trigger);
} }
zval_ptr_dtor(argv[0]); zval_ptr_dtor(argv[0]);
@ -397,8 +398,7 @@ PHP_FUNCTION(cyrus_bind)
hash = HASH_OF(*z_callback); hash = HASH_OF(*z_callback);
if (! hash) { if (! hash) {
php_error(E_WARNING, php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument must be an array or object");
"%s(): Second argument must be an array or object", get_active_function_name(TSRMLS_C));
RETURN_FALSE; RETURN_FALSE;
} }
@ -425,12 +425,12 @@ PHP_FUNCTION(cyrus_bind)
} }
if (! callback.trigger) { if (! callback.trigger) {
php_error(E_WARNING, "%s(): You must specify a trigger in your callback", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must specify a trigger in your callback");
RETURN_FALSE; RETURN_FALSE;
} }
if (! callback.function) { if (! callback.function) {
php_error(E_WARNING, "%s(): You must specify a function in your callback", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must specify a function in your callback");
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -374,7 +374,7 @@ PHP_FUNCTION(ldap_connect)
#endif #endif
if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) { if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), LDAPG(num_links)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", LDAPG(num_links));
RETURN_FALSE; RETURN_FALSE;
} }
@ -390,7 +390,7 @@ PHP_FUNCTION(ldap_connect)
rc = ldap_initialize(&ldap, host); rc = ldap_initialize(&ldap, host);
if (rc != LDAP_SUCCESS) { if (rc != LDAP_SUCCESS) {
efree(ld); efree(ld);
php_error(E_WARNING, "%s(): Could not create session handle: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle: %s", ldap_err2string(rc));
RETURN_FALSE; RETURN_FALSE;
} }
} else { } else {
@ -408,7 +408,7 @@ PHP_FUNCTION(ldap_connect)
if (ssl) { if (ssl) {
if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) { if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) {
efree(ld); efree(ld);
php_error(E_WARNING, "%s(): SSL init failed", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL init failed");
RETURN_FALSE; RETURN_FALSE;
} }
} }
@ -458,7 +458,7 @@ PHP_FUNCTION(ldap_bind)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) { if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Unable to bind to server: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
RETURN_FALSE; RETURN_FALSE;
} else { } else {
RETURN_TRUE; RETURN_TRUE;
@ -559,19 +559,19 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
case 4 : case 4 :
if (Z_TYPE_PP(attrs) != IS_ARRAY) { if (Z_TYPE_PP(attrs) != IS_ARRAY) {
php_error(E_WARNING, "%s(): Expected Array as last element", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as last element");
RETURN_FALSE; RETURN_FALSE;
} }
num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs)); num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs));
if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) { if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
php_error(E_WARNING, "%s(): Could not allocate memory", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not allocate memory");
RETURN_FALSE; RETURN_FALSE;
} }
for(i=0; i<num_attribs; i++) { for(i=0; i<num_attribs; i++) {
if(zend_hash_index_find(Z_ARRVAL_PP(attrs), i, (void **) &attr) == FAILURE) { if(zend_hash_index_find(Z_ARRVAL_PP(attrs), i, (void **) &attr) == FAILURE) {
php_error(E_WARNING, "%s(): Array initialization wrong", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array initialization wrong");
efree(ldap_attrs); efree(ldap_attrs);
RETURN_FALSE; RETURN_FALSE;
} }
@ -605,7 +605,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
nlinks = zend_hash_num_elements(Z_ARRVAL_PP(link)); nlinks = zend_hash_num_elements(Z_ARRVAL_PP(link));
if (nlinks == 0) { if (nlinks == 0) {
php_error(E_WARNING, "%s(): No links in link array", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No links in link array");
if (ldap_attrs != NULL) { if (ldap_attrs != NULL) {
efree(ldap_attrs); efree(ldap_attrs);
} }
@ -615,7 +615,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
if (Z_TYPE_PP(base_dn) == IS_ARRAY) { if (Z_TYPE_PP(base_dn) == IS_ARRAY) {
nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn)); nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn));
if (nbases != nlinks) { if (nbases != nlinks) {
php_error(E_WARNING, "%s(): Base must either be a string, or an array with the same number of elements as the links array", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Base must either be a string, or an array with the same number of elements as the links array");
if (ldap_attrs != NULL) { if (ldap_attrs != NULL) {
efree(ldap_attrs); efree(ldap_attrs);
} }
@ -631,7 +631,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
if (Z_TYPE_PP(filter) == IS_ARRAY) { if (Z_TYPE_PP(filter) == IS_ARRAY) {
nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter)); nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter));
if (nfilters != nlinks) { if (nfilters != nlinks) {
php_error(E_WARNING, "%s(): Filter must either be a string, or an array with the same number of elements as the links array", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filter must either be a string, or an array with the same number of elements as the links array");
if (ldap_attrs != NULL) { if (ldap_attrs != NULL) {
efree(ldap_attrs); efree(ldap_attrs);
} }
@ -736,15 +736,15 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
&& errno != LDAP_REFERRAL && errno != LDAP_REFERRAL
#endif #endif
) { ) {
php_error(E_WARNING, "%s(): Search: %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Search: %s", ldap_err2string(errno));
RETVAL_FALSE; RETVAL_FALSE;
} else { } else {
if (errno == LDAP_SIZELIMIT_EXCEEDED) { if (errno == LDAP_SIZELIMIT_EXCEEDED) {
php_error(E_WARNING, "%s(): Partial search results returned: Sizelimit exceeded.", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Sizelimit exceeded.");
} }
#ifdef LDAP_ADMINLIMIT_EXCEEDED #ifdef LDAP_ADMINLIMIT_EXCEEDED
else if (errno == LDAP_ADMINLIMIT_EXCEEDED) { else if (errno == LDAP_ADMINLIMIT_EXCEEDED) {
php_error(E_WARNING, "%s(): Partial search results returned: Adminlimit exceeded.", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Partial search results returned: Adminlimit exceeded.");
} }
#endif #endif
@ -1097,7 +1097,7 @@ PHP_FUNCTION(ldap_get_values)
attribute = Z_STRVAL_PP(attr); attribute = Z_STRVAL_PP(attr);
if ((ldap_value = ldap_get_values(ld->link, resultentry->data, attribute)) == NULL) { if ((ldap_value = ldap_get_values(ld->link, resultentry->data, attribute)) == NULL) {
php_error(E_WARNING, "%s(): Cannot get the value(s) of attribute %s", get_active_function_name(TSRMLS_C), ldap_err2string(_get_lderrno(ld->link))); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1137,7 +1137,7 @@ PHP_FUNCTION(ldap_get_values_len)
attribute = Z_STRVAL_PP(attr); attribute = Z_STRVAL_PP(attr);
if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attribute)) == NULL) { if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attribute)) == NULL) {
php_error(E_WARNING, "%s(): Cannot get the value(s) of attribute %s", get_active_function_name(TSRMLS_C), ldap_err2string(_get_lderrno(ld->link))); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ld->link)));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1264,7 +1264,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
} }
if (Z_TYPE_PP(entry) != IS_ARRAY) { if (Z_TYPE_PP(entry) != IS_ARRAY) {
php_error(E_WARNING, "%s(): Expected Array as the last element", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected Array as the last element");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1292,7 +1292,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) { if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) {
ldap_mods[i]->mod_type = estrdup(attribute); ldap_mods[i]->mod_type = estrdup(attribute);
} else { } else {
php_error(E_ERROR, "%s(): Unknown attribute in the data", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown attribute in the data");
/* Free allocated memory */ /* Free allocated memory */
while (i >= 0) { while (i >= 0) {
efree(ldap_mods[i--]); efree(ldap_mods[i--]);
@ -1322,7 +1322,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
} else { } else {
for(j=0; j < num_values; j++) { for(j=0; j < num_values; j++) {
if (zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue) == FAILURE) { if (zend_hash_index_find(Z_ARRVAL_PP(value), j, (void **) &ivalue) == FAILURE) {
php_error(E_WARNING, "%s(): Value array must have consecutive indices 0, 1, ...", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Value array must have consecutive indices 0, 1, ...");
num_berval[i] = j; num_berval[i] = j;
num_attribs = i + 1; num_attribs = i + 1;
RETVAL_FALSE; RETVAL_FALSE;
@ -1342,12 +1342,12 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
/* check flag to see if do_mod was called to perform full add , gerrit thomson */ /* check flag to see if do_mod was called to perform full add , gerrit thomson */
if (is_full_add == 1) { if (is_full_add == 1) {
if ((i = ldap_add_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) { if ((i = ldap_add_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Add: %s", get_active_function_name(TSRMLS_C), ldap_err2string(i)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Add: %s", ldap_err2string(i));
RETVAL_FALSE; RETVAL_FALSE;
} else RETVAL_TRUE; } else RETVAL_TRUE;
} else { } else {
if ((i = ldap_modify_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) { if ((i = ldap_modify_s(ld->link, ldap_dn, ldap_mods)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Modify: %s", get_active_function_name(TSRMLS_C), ldap_err2string(i)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modify: %s", ldap_err2string(i));
RETVAL_FALSE; RETVAL_FALSE;
} else RETVAL_TRUE; } else RETVAL_TRUE;
} }
@ -1422,7 +1422,7 @@ PHP_FUNCTION(ldap_delete)
ldap_dn = Z_STRVAL_PP(dn); ldap_dn = Z_STRVAL_PP(dn);
if ((rc = ldap_delete_s(ld->link, ldap_dn)) != LDAP_SUCCESS) { if ((rc = ldap_delete_s(ld->link, ldap_dn)) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): Delete: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Delete: %s", ldap_err2string(rc));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1517,7 +1517,7 @@ PHP_FUNCTION(ldap_compare)
break; break;
} }
php_error(E_WARNING, "%s(): Compare: %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno));
RETURN_LONG(-1); RETURN_LONG(-1);
} }
@ -1540,12 +1540,12 @@ PHP_FUNCTION(ldap_sort)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if (zend_hash_index_find(&EG(regular_list), Z_LVAL_P(result), (void **) &le) == FAILURE || le->type != le_result) { if (zend_hash_index_find(&EG(regular_list), Z_LVAL_P(result), (void **) &le) == FAILURE || le->type != le_result) {
php_error(E_WARNING, "%s(): Supplied resource is not a valid ldap result resource", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied resource is not a valid ldap result resource");
RETURN_FALSE; RETURN_FALSE;
} }
if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) { if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), ldap_err2string(errno)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ldap_err2string(errno));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1700,7 +1700,7 @@ PHP_FUNCTION(ldap_set_option)
char error=0; char error=0;
if ((Z_TYPE_PP(newval) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(newval)))) { if ((Z_TYPE_PP(newval) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(newval)))) {
php_error(E_WARNING, "%s(): Expected non-empty array value for this option", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected non-empty array value for this option");
RETURN_FALSE; RETURN_FALSE;
} }
ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls)); ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls));
@ -1709,12 +1709,12 @@ PHP_FUNCTION(ldap_set_option)
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval)); zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval));
while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) { while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) {
if (Z_TYPE_PP(ctrlval) != IS_ARRAY) { if (Z_TYPE_PP(ctrlval) != IS_ARRAY) {
php_error(E_WARNING, "%s(): The array value must contain only arrays, where each array is a control", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array value must contain only arrays, where each array is a control");
error = 1; error = 1;
break; break;
} }
if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) { if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) {
php_error(E_WARNING, "%s(): Control must have an oid key", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Control must have an oid key");
error = 1; error = 1;
break; break;
} }
@ -1785,7 +1785,7 @@ PHP_FUNCTION(ldap_parse_result)
NULL /* &serverctrls */, NULL /* &serverctrls */,
0 ); 0 );
if (rc != LDAP_SUCCESS ) { if (rc != LDAP_SUCCESS ) {
php_error(E_WARNING, "%s(): Unable to parse result: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse result: %s", ldap_err2string(rc));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1941,7 +1941,7 @@ PHP_FUNCTION(ldap_rename)
rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL); rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL);
#else #else
if (Z_STRLEN_PP(newparent) != 0) { if (Z_STRLEN_PP(newparent) != 0) {
php_error(E_WARNING, "%s(): You are using old LDAP API, newparent must be the empty string, can only modify RDN", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN");
RETURN_FALSE; RETURN_FALSE;
} }
/* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */ /* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */
@ -1971,7 +1971,7 @@ PHP_FUNCTION(ldap_start_tls)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) { if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) {
php_error(E_WARNING,"%s(): Unable to start TLS: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unable to start TLS: %s", ldap_err2string(rc));
RETURN_FALSE; RETURN_FALSE;
} else { } else {
RETURN_TRUE; RETURN_TRUE;
@ -1996,7 +1996,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
/* link exists and callback set? */ /* link exists and callback set? */
if (ld == NULL || ld->rebindproc == NULL) { if (ld == NULL || ld->rebindproc == NULL) {
php_error(E_WARNING, "%s(): Link not found or no callback set", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link not found or no callback set");
return LDAP_OTHER; return LDAP_OTHER;
} }
@ -2010,7 +2010,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
retval = Z_LVAL_P(cb_retval); retval = Z_LVAL_P(cb_retval);
zval_ptr_dtor(&cb_retval); zval_ptr_dtor(&cb_retval);
} else { } else {
php_error(E_WARNING, "%s(): rebind_proc PHP callback failed", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed");
retval = LDAP_OTHER; retval = LDAP_OTHER;
} }
zval_dtor(cb_url); zval_dtor(cb_url);
@ -2045,7 +2045,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
/* callable? */ /* callable? */
if (!zend_is_callable(callback, 0, &callback_name)) { if (!zend_is_callable(callback, 0, &callback_name)) {
php_error(E_WARNING, "%s(): Two arguments expected for '%s' to be a valid callback", get_active_function_name(TSRMLS_C), callback_name); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name);
efree(callback_name); efree(callback_name);
RETURN_FALSE; RETURN_FALSE;
} }
@ -2098,7 +2098,7 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
RETVAL_STRINGL(ldap_buf, ldap_len, 1); RETVAL_STRINGL(ldap_buf, ldap_len, 1);
free(ldap_buf); free(ldap_buf);
} else { } else {
php_error(E_ERROR, "%s(): Conversion from iso-8859-1 to t61 failed: %s", get_active_function_name(TSRMLS_C), ldap_err2string(result)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Conversion from iso-8859-1 to t61 failed: %s", ldap_err2string(result));
RETVAL_FALSE; RETVAL_FALSE;
} }

View file

@ -471,7 +471,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent)
#if UDM_VERSION_ID <= 30207 #if UDM_VERSION_ID <= 30207
Env->errcode=1; Env->errcode=1;
#endif #endif
php_error(E_WARNING,"%s(): Invalid DBAddr", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid DBAddr");
RETURN_FALSE; RETURN_FALSE;
} }
@ -524,7 +524,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent)
#if UDM_VERSION_ID <= 30207 #if UDM_VERSION_ID <= 30207
Env->errcode=1; Env->errcode=1;
#endif #endif
php_error(E_WARNING,"%s(): Invalid DBAddr", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid DBAddr");
RETURN_FALSE; RETURN_FALSE;
} }
Agent=UdmAgentInit(NULL,Env,0); Agent=UdmAgentInit(NULL,Env,0);
@ -626,7 +626,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
case UDM_MODE_PHRASE: case UDM_MODE_PHRASE:
#if UDM_VERSION_ID >= 30200 #if UDM_VERSION_ID >= 30200
php_error(E_WARNING,"%s(): Unknown search mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown search mode");
RETURN_FALSE; RETURN_FALSE;
#else #else
Agent->search_mode=UDM_MODE_PHRASE; Agent->search_mode=UDM_MODE_PHRASE;
@ -639,7 +639,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else #else
Agent->search_mode=UDM_MODE_ALL; Agent->search_mode=UDM_MODE_ALL;
#endif #endif
php_error(E_WARNING,"%s(): Unknown search mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown search mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -685,7 +685,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else #else
Agent->word_match=UDM_MATCH_WORD; Agent->word_match=UDM_MATCH_WORD;
#endif #endif
php_error(E_WARNING,"%s(): Unknown word match mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown word match mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -720,7 +720,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else #else
UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL); UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL);
#endif #endif
php_error(E_WARNING,"%s(): Unknown cache mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown cache mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -758,7 +758,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else #else
UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL); UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL);
#endif #endif
php_error(E_WARNING,"%s(): Unknown track mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown track mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -777,7 +777,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break; break;
default: default:
php_error(E_WARNING,"%s(): Unknown phrase mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown phrase mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -815,7 +815,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else #else
UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL); UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL);
#endif #endif
php_error(E_WARNING,"%s(): Unknown ispell prefixes mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown ispell prefixes mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -872,7 +872,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
case UDM_PARAM_SYNONYM: case UDM_PARAM_SYNONYM:
if (UdmSynonymListLoad(Agent->Conf,val)) { if (UdmSynonymListLoad(Agent->Conf,val)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C),Agent->Conf->errstr); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",Agent->Conf->errstr);
RETURN_FALSE; RETURN_FALSE;
#if UDM_VERSION_ID >= 30204 #if UDM_VERSION_ID >= 30204
} else UdmSynonymListSort(&(Agent->Conf->Synonyms)); } else UdmSynonymListSort(&(Agent->Conf->Synonyms));
@ -924,7 +924,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#else #else
if (UdmFileLoadStopList(Agent->Conf,val)) { if (UdmFileLoadStopList(Agent->Conf,val)) {
#endif #endif
php_error(E_WARNING, "%s(): %s", Agent->Conf->errstr, get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", Agent->Conf->errstr);
RETURN_FALSE; RETURN_FALSE;
} }
break; break;
@ -991,7 +991,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break; break;
default: default:
php_error(E_WARNING,"%s(): Unknown crosswords mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown crosswords mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -1040,7 +1040,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break; break;
default: default:
php_error(E_WARNING,"%s(): Unknown groupbysite mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown groupbysite mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -1065,7 +1065,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
break; break;
default: default:
php_error(E_WARNING,"%s(): Unknown clones mode", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown clones mode");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -1074,7 +1074,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param)
#endif #endif
default: default:
php_error(E_WARNING,"%s(): Unknown agent session parameter", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown agent session parameter");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -1168,12 +1168,12 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
#endif #endif
if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) { if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) {
php_error(E_WARNING,"%s(): Cannot load affix file %s", get_active_function_name(TSRMLS_C),val2); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load affix file %s",val2);
RETURN_FALSE; RETURN_FALSE;
} }
#else #else
if (UdmImportAffixes(Agent->Conf,val1,charset,val2)) { if (UdmImportAffixes(Agent->Conf,val1,charset,val2)) {
php_error(E_WARNING,"%s(): Cannot load affix file %s", get_active_function_name(TSRMLS_C),val2); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load affix file %s",val2);
RETURN_FALSE; RETURN_FALSE;
} }
@ -1189,12 +1189,12 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
#endif #endif
if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) { if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) {
php_error(E_WARNING,"%s(): Cannot load spell file %s", get_active_function_name(TSRMLS_C),val2); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load spell file %s",val2);
RETURN_FALSE; RETURN_FALSE;
} }
#else #else
if (UdmImportDictionary(Agent->Conf,val1,charset,val2,0,"")) { if (UdmImportDictionary(Agent->Conf,val1,charset,val2,0,"")) {
php_error(E_WARNING,"%s(): Cannot load spell file %s", get_active_function_name(TSRMLS_C),val2); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot load spell file %s",val2);
RETURN_FALSE; RETURN_FALSE;
} }
#endif #endif
@ -1202,7 +1202,7 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
default: default:
php_error(E_WARNING,"%s(): Unknown ispell type parameter", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown ispell type parameter");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -1336,7 +1336,7 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit)
Z_TYPE(stl_info)=2; Z_TYPE(stl_info)=2;
stl_info.t2=(time_t)(atol(edate+1)); stl_info.t2=(time_t)(atol(edate+1));
} else { } else {
php_error(E_WARNING,"%s(): Incorrect date limit format", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Incorrect date limit format");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1346,7 +1346,7 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit)
#endif #endif
break; break;
default: default:
php_error(E_WARNING,"%s(): Unknown search limit parameter", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown search limit parameter");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
@ -1666,7 +1666,7 @@ DLEXPORT PHP_FUNCTION(udm_make_excerpt)
RETURN_FALSE; RETURN_FALSE;
} }
}else{ }else{
php_error(E_WARNING,"%s(): row number too large", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"row number too large");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1711,12 +1711,12 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param_ex)
Agent->Conf->bcs=UdmGetCharSet(charset); Agent->Conf->bcs=UdmGetCharSet(charset);
} else if (!strcasecmp(var,"Synonym")) { } else if (!strcasecmp(var,"Synonym")) {
if (UdmSynonymListLoad(Agent->Conf,val)) { if (UdmSynonymListLoad(Agent->Conf,val)) {
php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C),Agent->Conf->errstr); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",Agent->Conf->errstr);
RETURN_FALSE; RETURN_FALSE;
} else UdmSynonymListSort(&(Agent->Conf->Synonyms)); } else UdmSynonymListSort(&(Agent->Conf->Synonyms));
} else if (!strcasecmp(var,"Stopwordfile")) { } else if (!strcasecmp(var,"Stopwordfile")) {
if (UdmStopListLoad(Agent->Conf,val)) { if (UdmStopListLoad(Agent->Conf,val)) {
php_error(E_WARNING, "%s(): %s", Agent->Conf->errstr, get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", Agent->Conf->errstr);
RETURN_FALSE; RETURN_FALSE;
} }
} else if (!strcasecmp(var,"MinWordLen")) { } else if (!strcasecmp(var,"MinWordLen")) {
@ -1768,7 +1768,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_field_ex)
} }
RETURN_STRING((char *)UdmVarListFindStr(&Res->Doc[row].Sections,field,""),1); RETURN_STRING((char *)UdmVarListFindStr(&Res->Doc[row].Sections,field,""),1);
} else { } else {
php_error(E_WARNING,"%s(): row number too large", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"row number too large");
RETURN_FALSE; RETURN_FALSE;
} }
} }
@ -1984,12 +1984,12 @@ DLEXPORT PHP_FUNCTION(udm_get_res_field)
#endif #endif
default: default:
php_error(E_WARNING,"%s(): Unknown mnoGoSearch field name", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown mnoGoSearch field name");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }
}else{ }else{
php_error(E_WARNING,"%s(): row number too large", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"row number too large");
RETURN_FALSE; RETURN_FALSE;
} }
} }
@ -2106,7 +2106,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
break; break;
default: default:
php_error(E_WARNING,"%s(): Unknown mnoGoSearch param name", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unknown mnoGoSearch param name");
RETURN_FALSE; RETURN_FALSE;
break; break;
} }

View file

@ -59,8 +59,8 @@
/* Test if system is OK fror use. */ /* Test if system is OK fror use. */
/* Macros may be ugly, but I can globaly add debuging when needed. */ /* Macros may be ugly, but I can globaly add debuging when needed. */
#define IFCONNECT_BEGIN if(s_reqb && s_conn) { #define IFCONNECT_BEGIN if(s_reqb && s_conn) {
#define IFCONNECT_ENDVAL(V) } else { php_error(E_WARNING, s_szNoInit, get_active_function_name(TSRMLS_C)); return V; } #define IFCONNECT_ENDVAL(V) } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szNoInit); return V; }
#define IFCONNECT_END } else { php_error(E_WARNING, s_szNoInit, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } #define IFCONNECT_END } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szNoInit); RETURN_FALSE; }
#ifndef HAVE_PHP_SESSION #ifndef HAVE_PHP_SESSION
#error HAVE_PHP_SESSION not defined #error HAVE_PHP_SESSION not defined
@ -117,8 +117,8 @@ ps_module ps_mod_msession = {
#endif #endif
/* Static strings */ /* Static strings */
static char s_szNoInit[]="%s(): Msession not initialized"; static char s_szNoInit[]="Msession not initialized";
static char s_szErrFmt[]="%s(): %s"; static char s_szErrFmt[]="%s";
/* Per-process variables need by msession */ /* Per-process variables need by msession */
static char s_szdefhost[]="localhost"; static char s_szdefhost[]="localhost";
@ -354,7 +354,7 @@ int PHPMsessionSetData(const char *session, const char *data TSRMLS_DC)
PHPDoRequest(&s_conn,&s_reqb); PHPDoRequest(&s_conn,&s_reqb);
ret = (s_reqb->req.stat==REQ_OK); ret = (s_reqb->req.stat==REQ_OK);
if(s_reqb->req.stat!=REQ_OK) if(s_reqb->req.stat!=REQ_OK)
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
return ret; return ret;
@ -369,7 +369,7 @@ int PHPMsessionDestroy(const char *session TSRMLS_DC)
PHPDoRequest(&s_conn,&s_reqb); PHPDoRequest(&s_conn,&s_reqb);
ret = (s_reqb->req.stat==REQ_OK); ret = (s_reqb->req.stat==REQ_OK);
if(s_reqb->req.stat!=REQ_OK) if(s_reqb->req.stat!=REQ_OK)
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
return ret; return ret;
IFCONNECT_ENDVAL(0) IFCONNECT_ENDVAL(0)
@ -402,7 +402,7 @@ PHP_FUNCTION(msession_connect)
} }
else else
{ {
php_error(E_WARNING, "%s(): MSession connect failed", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "MSession connect failed");
RETURN_FALSE; RETURN_FALSE;
} }
} }
@ -458,7 +458,7 @@ PHP_FUNCTION(msession_create)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
IFCONNECT_END IFCONNECT_END
@ -506,7 +506,7 @@ PHP_FUNCTION(msession_lock)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
@ -614,7 +614,7 @@ PHP_FUNCTION(msession_unlock)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
IFCONNECT_END IFCONNECT_END
@ -655,7 +655,7 @@ PHP_FUNCTION(msession_set)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
IFCONNECT_END IFCONNECT_END
@ -695,7 +695,7 @@ PHP_FUNCTION(msession_get)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -728,7 +728,7 @@ PHP_FUNCTION(msession_uniq)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -761,7 +761,7 @@ PHP_FUNCTION(msession_randstr)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -807,7 +807,7 @@ PHP_FUNCTION(msession_find)
} }
else if(s_reqb->req.stat != REQ_OK) else if(s_reqb->req.stat != REQ_OK)
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -840,7 +840,7 @@ PHP_FUNCTION(msession_list)
{ {
/* May this should be an error? */ /* May this should be an error? */
if(s_reqb->req.param != REQE_NOSESSION) if(s_reqb->req.param != REQE_NOSESSION)
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -891,7 +891,7 @@ PHP_FUNCTION(msession_get_array)
else else
{ {
if(s_reqb->req.param != REQE_NOSESSION) if(s_reqb->req.param != REQE_NOSESSION)
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -977,7 +977,7 @@ PHP_FUNCTION(msession_set_array)
PHPDoRequest(&s_conn,&s_reqb); PHPDoRequest(&s_conn,&s_reqb);
if(s_reqb->req.stat != REQ_OK) if(s_reqb->req.stat != REQ_OK)
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
efree((void *)pairs); efree((void *)pairs);
IFCONNECT_END IFCONNECT_END
} }
@ -1024,7 +1024,7 @@ PHP_FUNCTION(msession_listvar)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -1065,7 +1065,7 @@ PHP_FUNCTION(msession_timeout)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_NULL(); RETURN_NULL();
} }
IFCONNECT_END IFCONNECT_END
@ -1098,7 +1098,7 @@ PHP_FUNCTION(msession_inc)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
IFCONNECT_END IFCONNECT_END
@ -1203,7 +1203,7 @@ PHP_FUNCTION(msession_plugin)
} }
else if(s_reqb->req.stat != REQ_OK) else if(s_reqb->req.stat != REQ_OK)
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1253,7 +1253,7 @@ PHP_FUNCTION(msession_call)
} }
else if(s_reqb->req.stat != REQ_OK) else if(s_reqb->req.stat != REQ_OK)
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
RETURN_FALSE; RETURN_FALSE;
} }
IFCONNECT_END IFCONNECT_END
@ -1347,7 +1347,7 @@ PS_CREATE_SID_FUNC(msession)
} }
else else
{ {
php_error(E_WARNING, s_szErrFmt, get_active_function_name(TSRMLS_C), ReqbErr(s_reqb)); php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szErrFmt, ReqbErr(s_reqb));
} }
} }
ELOG("Yikes, could not get sid from msession"); ELOG("Yikes, could not get sid from msession");

View file

@ -267,12 +267,12 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
list_entry *le; list_entry *le;
if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) {
php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C), msql_globals.num_links); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", msql_globals.num_links);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) { if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) {
php_error(E_WARNING, "%s(): Too many open persistent links (%d)", get_active_function_name(TSRMLS_C), msql_globals.num_persistent); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", msql_globals.num_persistent);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
@ -306,7 +306,7 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
/* still have to find a way to do this nicely with mSQL */ /* still have to find a way to do this nicely with mSQL */
if (msql_stat(le->ptr)==NULL) { /* the link died */ if (msql_stat(le->ptr)==NULL) { /* the link died */
if (msql_connect(le->ptr,host,user,passwd)==NULL) { if (msql_connect(le->ptr,host,user,passwd)==NULL) {
php_error(E_WARNING,"mSQL link lost, unable to reconnect"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "mSQL link lost, unable to reconnect");
zend_hash_del(&EG(persistent_list),hashed_details,hashed_details_length+1); zend_hash_del(&EG(persistent_list),hashed_details,hashed_details_length+1);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
@ -343,7 +343,7 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
} }
} }
if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) {
php_error(E_WARNING, "%s(): Too many open links (%d)", get_active_function_name(TSRMLS_C),msql_globals.num_links); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)",msql_globals.num_links);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
@ -655,7 +655,7 @@ PHP_FUNCTION(msql_list_dbs)
ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
if ((msql_result=msqlListDBs(msql))==NULL) { if ((msql_result=msqlListDBs(msql))==NULL) {
php_error(E_WARNING, "%s(): Unable to save mSQL query result", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save mSQL query result");
RETURN_FALSE; RETURN_FALSE;
} }
ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query); ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
@ -696,7 +696,7 @@ PHP_FUNCTION(msql_list_tables)
RETURN_FALSE; RETURN_FALSE;
} }
if ((msql_result=msqlListTables(msql))==NULL) { if ((msql_result=msqlListTables(msql))==NULL) {
php_error(E_WARNING, "%s(): Unable to save mSQL query result", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save mSQL query result");
RETURN_FALSE; RETURN_FALSE;
} }
ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query); ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
@ -738,7 +738,7 @@ PHP_FUNCTION(msql_list_fields)
} }
convert_to_string(table); convert_to_string(table);
if ((msql_result=msqlListFields(msql,Z_STRVAL_P(table)))==NULL) { if ((msql_result=msqlListFields(msql,Z_STRVAL_P(table)))==NULL) {
php_error(E_WARNING, "%s(): Unable to save mSQL query result", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to save mSQL query result");
RETURN_FALSE; RETURN_FALSE;
} }
ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query); ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
@ -786,7 +786,7 @@ PHP_FUNCTION(msql_result)
convert_to_long(row); convert_to_long(row);
if (Z_LVAL_P(row)<0 || Z_LVAL_P(row)>=msqlNumRows(msql_result)) { if (Z_LVAL_P(row)<0 || Z_LVAL_P(row)>=msqlNumRows(msql_result)) {
php_error(E_WARNING, "%s(): Unable to jump to row %d on mSQL query index %d", get_active_function_name(TSRMLS_C),Z_LVAL_P(row),Z_LVAL_P(result)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %d on mSQL query index %d",Z_LVAL_P(row),Z_LVAL_P(result));
RETURN_FALSE; RETURN_FALSE;
} }
msqlDataSeek(msql_result,Z_LVAL_P(row)); msqlDataSeek(msql_result,Z_LVAL_P(row));
@ -818,7 +818,7 @@ PHP_FUNCTION(msql_result)
i++; i++;
} }
if (!tmp_field) { /* no match found */ if (!tmp_field) { /* no match found */
php_error(E_WARNING, "%s(): %s%s%s not found in mSQL query index %d", get_active_function_name(TSRMLS_C), php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s%s%s not found in mSQL query index %d",
(table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_P(result)); (table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_P(result));
efree(field_name); efree(field_name);
if (table_name) { if (table_name) {
@ -836,7 +836,7 @@ PHP_FUNCTION(msql_result)
convert_to_long(field); convert_to_long(field);
field_offset = Z_LVAL_P(field); field_offset = Z_LVAL_P(field);
if (field_offset<0 || field_offset>=msqlNumFields(msql_result)) { if (field_offset<0 || field_offset>=msqlNumFields(msql_result)) {
php_error(E_WARNING, "%s(): Bad column offset specified", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
RETURN_FALSE; RETURN_FALSE;
} }
break; break;
@ -1010,7 +1010,7 @@ PHP_FUNCTION(msql_data_seek)
if (!msql_result || if (!msql_result ||
Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)<0 ||
Z_LVAL_P(offset)>=msqlNumRows(msql_result)) { Z_LVAL_P(offset)>=msqlNumRows(msql_result)) {
php_error(E_WARNING, "%s(): %d is invalid for mSQL query index %d", get_active_function_name(TSRMLS_C),Z_LVAL_P(offset),Z_LVAL_P(result)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is invalid for mSQL query index %d",Z_LVAL_P(offset),Z_LVAL_P(result));
RETURN_FALSE; RETURN_FALSE;
} }
msqlDataSeek(msql_result,Z_LVAL_P(offset)); msqlDataSeek(msql_result,Z_LVAL_P(offset));
@ -1087,7 +1087,7 @@ PHP_FUNCTION(msql_fetch_field)
if (field) { if (field) {
if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumRows(msql_result)) { if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumRows(msql_result)) {
php_error(E_NOTICE, "%s(): Bad field offset specified", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Bad field offset specified");
RETURN_FALSE; RETURN_FALSE;
} }
msqlFieldSeek(msql_result,Z_LVAL_P(field)); msqlFieldSeek(msql_result,Z_LVAL_P(field));
@ -1130,7 +1130,7 @@ PHP_FUNCTION(msql_field_seek)
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=msqlNumFields(msql_result)) { if (Z_LVAL_P(offset)<0 || Z_LVAL_P(offset)>=msqlNumFields(msql_result)) {
php_error(E_WARNING,"%s(): Field %d is invalid for mSQL query index %d", get_active_function_name(TSRMLS_C), php_error_docref(NULL TSRMLS_CC, E_WARNING,"Field %d is invalid for mSQL query index %d",
Z_LVAL_P(offset),Z_LVAL_P(result)); Z_LVAL_P(offset),Z_LVAL_P(result));
RETURN_FALSE; RETURN_FALSE;
} }
@ -1164,7 +1164,7 @@ static void php_msql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
} }
convert_to_long(field); convert_to_long(field);
if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumFields(msql_result)) { if (Z_LVAL_P(field)<0 || Z_LVAL_P(field)>=msqlNumFields(msql_result)) {
php_error(E_WARNING,"%s(): Field %d is invalid for mSQL query index %d", get_active_function_name(TSRMLS_C),Z_LVAL_P(field),Z_LVAL_P(result)); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Field %d is invalid for mSQL query index %d",Z_LVAL_P(field),Z_LVAL_P(result));
RETURN_FALSE; RETURN_FALSE;
} }
msqlFieldSeek(msql_result,Z_LVAL_P(field)); msqlFieldSeek(msql_result,Z_LVAL_P(field));

View file

@ -102,7 +102,7 @@ ZEND_DECLARE_MODULE_GLOBALS(mssql)
ZEND_GET_MODULE(mssql) ZEND_GET_MODULE(mssql)
#endif #endif
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "%s(): A link to the server could not be established", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } #define CHECK_LINK(link) { if (link==-1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A link to the server could not be established"); RETURN_FALSE; } }
static PHP_INI_DISP(display_text_size) static PHP_INI_DISP(display_text_size)
{ {

View file

@ -236,7 +236,7 @@ PHP_FUNCTION(birdstep_connect)
long ind; long ind;
if ( php_birdstep_module.max_links != -1 && php_birdstep_module.num_links == php_birdstep_module.max_links ) { if ( php_birdstep_module.max_links != -1 && php_birdstep_module.num_links == php_birdstep_module.max_links ) {
php_error(E_WARNING,"Birdstep: Too many open connections (%d)",php_birdstep_module.num_links); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Too many open connections (%d)",php_birdstep_module.num_links);
RETURN_FALSE; RETURN_FALSE;
} }
if (ZEND_NUM_ARGS() != 3 || getParameters(ht,3,&serv,&user,&pass) == FAILURE ) { if (ZEND_NUM_ARGS() != 3 || getParameters(ht,3,&serv,&user,&pass) == FAILURE ) {
@ -250,21 +250,16 @@ PHP_FUNCTION(birdstep_connect)
Pass = Z_STRVAL_P(pass); Pass = Z_STRVAL_P(pass);
stat = SQLAllocConnect(henv,&hdbc); stat = SQLAllocConnect(henv,&hdbc);
if ( stat != SQL_SUCCESS ) { if ( stat != SQL_SUCCESS ) {
php_error(E_WARNING,"Birdstep: Could not allocate connection handle"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not allocate connection handle");
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS); stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: Could not connect to server \"%s\" for %s",Serv,User); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not connect to server \"%s\" for %s",Serv,User);
SQLFreeConnect(hdbc); SQLFreeConnect(hdbc);
RETURN_FALSE; RETURN_FALSE;
} }
new = (VConn *)emalloc(sizeof(VConn)); new = (VConn *)emalloc(sizeof(VConn));
if ( new == NULL ) {
php_error(E_WARNING,"Birdstep: Out of memory for store connection");
SQLFreeConnect(hdbc);
RETURN_FALSE;
}
ind = birdstep_add_conn(list,new,hdbc); ind = birdstep_add_conn(list,new,hdbc);
php_birdstep_module.num_links++; php_birdstep_module.num_links++;
RETURN_LONG(ind); RETURN_LONG(ind);
@ -284,7 +279,7 @@ PHP_FUNCTION(birdstep_close)
convert_to_long(id); convert_to_long(id);
conn = birdstep_find_conn(list,Z_LVAL_P(id)); conn = birdstep_find_conn(list,Z_LVAL_P(id));
if ( !conn ) { if ( !conn ) {
php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)",Z_LVAL_P(id));
RETURN_FALSE; RETURN_FALSE;
} }
SQLDisconnect(conn->hdbc); SQLDisconnect(conn->hdbc);
@ -314,26 +309,22 @@ PHP_FUNCTION(birdstep_exec)
convert_to_long(ind); convert_to_long(ind);
conn = birdstep_find_conn(list,Z_LVAL_P(ind)); conn = birdstep_find_conn(list,Z_LVAL_P(ind));
if ( !conn ) { if ( !conn ) {
php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(ind)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)",Z_LVAL_P(ind));
RETURN_FALSE; RETURN_FALSE;
} }
convert_to_string(exec_str); convert_to_string(exec_str);
query = Z_STRVAL_P(exec_str); query = Z_STRVAL_P(exec_str);
res = (Vresult *)emalloc(sizeof(Vresult)); res = (Vresult *)emalloc(sizeof(Vresult));
if ( res == NULL ) {
php_error(E_WARNING,"Birdstep: Out of memory for result");
RETURN_FALSE;
}
stat = SQLAllocStmt(conn->hdbc,&res->hstmt); stat = SQLAllocStmt(conn->hdbc,&res->hstmt);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: SQLAllocStmt return %d",stat); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLAllocStmt return %d",stat);
efree(res); efree(res);
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLExecDirect(res->hstmt,query,SQL_NTS); stat = SQLExecDirect(res->hstmt,query,SQL_NTS);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: Can not execute \"%s\" query",query); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Can not execute \"%s\" query",query);
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res); efree(res);
RETURN_FALSE; RETURN_FALSE;
@ -341,7 +332,7 @@ PHP_FUNCTION(birdstep_exec)
/* Success query */ /* Success query */
stat = SQLNumResultCols(res->hstmt,&cols); stat = SQLNumResultCols(res->hstmt,&cols);
if ( stat != SQL_SUCCESS ) { if ( stat != SQL_SUCCESS ) {
php_error(E_WARNING,"Birdstep: SQLNumResultCols return %d",stat); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat);
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res); efree(res);
RETURN_FALSE; RETURN_FALSE;
@ -349,7 +340,7 @@ PHP_FUNCTION(birdstep_exec)
if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */ if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */
stat = SQLRowCount(res->hstmt,&rows); stat = SQLRowCount(res->hstmt,&rows);
if ( stat != SQL_SUCCESS ) { if ( stat != SQL_SUCCESS ) {
php_error(E_WARNING,"Birdstep: SQLNumResultCols return %d",stat); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat);
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res); efree(res);
RETURN_FALSE; RETURN_FALSE;
@ -359,12 +350,6 @@ PHP_FUNCTION(birdstep_exec)
RETURN_LONG(rows); RETURN_LONG(rows);
} else { /* Was SELECT query */ } else { /* Was SELECT query */
res->values = (VResVal *)emalloc(sizeof(VResVal)*cols); res->values = (VResVal *)emalloc(sizeof(VResVal)*cols);
if ( res->values == NULL ) {
php_error(E_WARNING,"Birdstep: Out of memory for result columns");
SQLFreeStmt(res->hstmt,SQL_DROP);
efree(res);
RETURN_FALSE;
}
res->numcols = cols; res->numcols = cols;
for ( i = 0; i < cols; i++ ) { for ( i = 0; i < cols; i++ ) {
SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME, SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME,
@ -412,7 +397,7 @@ PHP_FUNCTION(birdstep_fetch)
convert_to_long(ind); convert_to_long(ind);
res = birdstep_find_result(list,Z_LVAL_P(ind)); res = birdstep_find_result(list,Z_LVAL_P(ind));
if ( !res ) { if ( !res ) {
php_error(E_WARNING,"Birdstep: Not result index (%d)",Z_LVAL_P(ind)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d)",Z_LVAL_P(ind));
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
@ -422,7 +407,7 @@ PHP_FUNCTION(birdstep_fetch)
RETURN_FALSE; RETURN_FALSE;
} }
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: SQLFetch return error"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
birdstep_del_result(list,Z_LVAL_P(ind)); birdstep_del_result(list,Z_LVAL_P(ind));
RETURN_FALSE; RETURN_FALSE;
@ -451,7 +436,7 @@ PHP_FUNCTION(birdstep_result)
convert_to_long(ind); convert_to_long(ind);
res = birdstep_find_result(list,Z_LVAL_P(ind)); res = birdstep_find_result(list,Z_LVAL_P(ind));
if ( !res ) { if ( !res ) {
php_error(E_WARNING,"Birdstep: Not result index (%d),Z_LVAL_P(ind)"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d),Z_LVAL_P(ind)");
RETURN_FALSE; RETURN_FALSE;
} }
if ( Z_TYPE_P(col) == IS_STRING ) { if ( Z_TYPE_P(col) == IS_STRING ) {
@ -468,12 +453,12 @@ PHP_FUNCTION(birdstep_result)
} }
} }
if ( indx < 0 ) { if ( indx < 0 ) {
php_error(E_WARNING, "Field %s not found",field); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found",field);
RETURN_FALSE; RETURN_FALSE;
} }
} else { } else {
if ( indx < 0 || indx >= res->numcols ) { if ( indx < 0 || indx >= res->numcols ) {
php_error(E_WARNING,"Birdstep: Field index not in range"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range");
RETURN_FALSE; RETURN_FALSE;
} }
} }
@ -485,7 +470,7 @@ PHP_FUNCTION(birdstep_result)
RETURN_FALSE; RETURN_FALSE;
} }
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: SQLFetch return error"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error");
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
birdstep_del_result(list,Z_LVAL_P(ind)); birdstep_del_result(list,Z_LVAL_P(ind));
RETURN_FALSE; RETURN_FALSE;
@ -501,10 +486,6 @@ PHP_FUNCTION(birdstep_result)
l1: l1:
if ( !res->values[indx].value ) { if ( !res->values[indx].value ) {
res->values[indx].value = emalloc(4096); res->values[indx].value = emalloc(4096);
if ( !res->values[indx].value ) {
php_error(E_WARNING,"Out of memory");
RETURN_FALSE;
}
} }
stat = SQLGetData(res->hstmt,indx+1,sql_c_type, stat = SQLGetData(res->hstmt,indx+1,sql_c_type,
res->values[indx].value,4095,&res->values[indx].vallen); res->values[indx].value,4095,&res->values[indx].vallen);
@ -514,7 +495,7 @@ l1:
RETURN_FALSE; RETURN_FALSE;
} }
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: SQLGetData return error"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error");
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
birdstep_del_result(list,Z_LVAL_P(ind)); birdstep_del_result(list,Z_LVAL_P(ind));
RETURN_FALSE; RETURN_FALSE;
@ -545,7 +526,7 @@ PHP_FUNCTION(birdstep_freeresult)
convert_to_long(ind); convert_to_long(ind);
res = birdstep_find_result(list,Z_LVAL_P(ind)); res = birdstep_find_result(list,Z_LVAL_P(ind));
if ( !res ) { if ( !res ) {
php_error(E_WARNING,"Birdstep: Not result index (%d)",Z_LVAL_P(ind)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d)",Z_LVAL_P(ind));
RETURN_FALSE; RETURN_FALSE;
} }
SQLFreeStmt(res->hstmt,SQL_DROP); SQLFreeStmt(res->hstmt,SQL_DROP);
@ -568,12 +549,12 @@ PHP_FUNCTION(birdstep_autocommit)
convert_to_long(id); convert_to_long(id);
conn = birdstep_find_conn(list,Z_LVAL_P(id)); conn = birdstep_find_conn(list,Z_LVAL_P(id));
if ( !conn ) { if ( !conn ) {
php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)",Z_LVAL_P(id));
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON); stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: Set autocommit_on option failure"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_on option failure");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_TRUE; RETURN_TRUE;
@ -594,12 +575,12 @@ PHP_FUNCTION(birdstep_off_autocommit)
convert_to_long(id); convert_to_long(id);
conn = birdstep_find_conn(list,Z_LVAL_P(id)); conn = birdstep_find_conn(list,Z_LVAL_P(id));
if ( !conn ) { if ( !conn ) {
php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)",Z_LVAL_P(id));
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF); stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF);
if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
php_error(E_WARNING,"Birdstep: Set autocommit_off option failure"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_off option failure");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_TRUE; RETURN_TRUE;
@ -620,12 +601,12 @@ PHP_FUNCTION(birdstep_commit)
convert_to_long(id); convert_to_long(id);
conn = birdstep_find_conn(list,Z_LVAL_P(id)); conn = birdstep_find_conn(list,Z_LVAL_P(id));
if ( !conn ) { if ( !conn ) {
php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)",Z_LVAL_P(id));
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT); stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT);
if ( stat != SQL_SUCCESS ) { if ( stat != SQL_SUCCESS ) {
php_error(E_WARNING,"Birdstep: Commit failure"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Commit failure");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_TRUE; RETURN_TRUE;
@ -646,12 +627,12 @@ PHP_FUNCTION(birdstep_rollback)
convert_to_long(id); convert_to_long(id);
conn = birdstep_find_conn(list,Z_LVAL_P(id)); conn = birdstep_find_conn(list,Z_LVAL_P(id));
if ( !conn ) { if ( !conn ) {
php_error(E_WARNING,"Birdstep: Not connection index (%d)",Z_LVAL_P(id)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%d)",Z_LVAL_P(id));
RETURN_FALSE; RETURN_FALSE;
} }
stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK); stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK);
if ( stat != SQL_SUCCESS ) { if ( stat != SQL_SUCCESS ) {
php_error(E_WARNING,"Birdstep: Rollback failure"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Rollback failure");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_TRUE; RETURN_TRUE;
@ -672,13 +653,13 @@ PHP_FUNCTION(birdstep_fieldname)
convert_to_long(ind); convert_to_long(ind);
res = birdstep_find_result(list,Z_LVAL_P(ind)); res = birdstep_find_result(list,Z_LVAL_P(ind));
if ( !res ) { if ( !res ) {
php_error(E_WARNING,"Birdstep: Not result index (%d),Z_LVAL_P(ind)"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d),Z_LVAL_P(ind)");
RETURN_FALSE; RETURN_FALSE;
} }
convert_to_long(col); convert_to_long(col);
indx = Z_LVAL_P(col); indx = Z_LVAL_P(col);
if ( indx < 0 || indx >= res->numcols ) { if ( indx < 0 || indx >= res->numcols ) {
php_error(E_WARNING,"Birdstep: Field index not in range"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_STRING(res->values[indx].name,TRUE); RETURN_STRING(res->values[indx].name,TRUE);
@ -698,7 +679,7 @@ PHP_FUNCTION(birdstep_fieldnum)
convert_to_long(ind); convert_to_long(ind);
res = birdstep_find_result(list,Z_LVAL_P(ind)); res = birdstep_find_result(list,Z_LVAL_P(ind));
if ( !res ) { if ( !res ) {
php_error(E_WARNING,"Birdstep: Not result index (%d),Z_LVAL_P(ind)"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%d),Z_LVAL_P(ind)");
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_LONG(res->numcols); RETURN_LONG(res->numcols);

View file

@ -588,9 +588,9 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS)
memcpy(ODBCG(laststate), state, sizeof(state)); memcpy(ODBCG(laststate), state, sizeof(state));
memcpy(ODBCG(lasterrormsg), errormsg, sizeof(errormsg)); memcpy(ODBCG(lasterrormsg), errormsg, sizeof(errormsg));
if (func) { if (func) {
php_error(E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func); php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func);
} else { } else {
php_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state); php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
} }
/* /*
} while (SQL_SUCCEEDED(rc)); } while (SQL_SUCCEEDED(rc));
@ -636,12 +636,6 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
result->values = (odbc_result_value *) emalloc(sizeof(odbc_result_value)*result->numcols); result->values = (odbc_result_value *) emalloc(sizeof(odbc_result_value)*result->numcols);
if (result->values == NULL) {
php_error(E_WARNING, "Out of memory");
SQLFreeStmt(result->stmt, SQL_DROP);
return 0;
}
result->longreadlen = ODBCG(defaultlrl); result->longreadlen = ODBCG(defaultlrl);
result->binmode = ODBCG(defaultbinmode); result->binmode = ODBCG(defaultbinmode);
@ -745,17 +739,17 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_PP(pv_num) > result->numcols) { if (Z_LVAL_PP(pv_num) > result->numcols) {
php_error(E_WARNING, "Field index larger than number of fields"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_PP(pv_num) < 1) { if (Z_LVAL_PP(pv_num) < 1) {
php_error(E_WARNING, "Field numbering starts at 1"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
RETURN_FALSE; RETURN_FALSE;
} }
@ -850,10 +844,6 @@ PHP_FUNCTION(odbc_prepare)
query = Z_STRVAL_PP(pv_query); query = Z_STRVAL_PP(pv_query);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
result->numparams = 0; result->numparams = 0;
@ -968,13 +958,13 @@ PHP_FUNCTION(odbc_execute)
/* XXX check for already bound parameters*/ /* XXX check for already bound parameters*/
if (result->numparams > 0 && numArgs == 1) { if (result->numparams > 0 && numArgs == 1) {
php_error(E_WARNING, "No parameters to SQL statement given"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No parameters to SQL statement given");
RETURN_FALSE; RETURN_FALSE;
} }
if (result->numparams > 0) { if (result->numparams > 0) {
if ((ne = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr))) < result->numparams) { if ((ne = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr))) < result->numparams) {
php_error(E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->numparams); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Not enough parameters (%d should be %d) given", ne, result->numparams);
RETURN_FALSE; RETURN_FALSE;
} }
@ -983,7 +973,7 @@ PHP_FUNCTION(odbc_execute)
for(i = 1; i <= result->numparams; i++) { for(i = 1; i <= result->numparams; i++) {
if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) { if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) {
php_error(E_WARNING,"Error getting parameter"); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error getting parameter");
SQLFreeStmt(result->stmt,SQL_RESET_PARAMS); SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
efree(params); efree(params);
RETURN_FALSE; RETURN_FALSE;
@ -992,7 +982,7 @@ PHP_FUNCTION(odbc_execute)
otype = (*tmp)->type; otype = (*tmp)->type;
convert_to_string(*tmp); convert_to_string(*tmp);
if (Z_TYPE_PP(tmp) != IS_STRING) { if (Z_TYPE_PP(tmp) != IS_STRING) {
php_error(E_WARNING,"Error converting parameter"); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
efree(params); efree(params);
RETURN_FALSE; RETURN_FALSE;
@ -1025,7 +1015,7 @@ PHP_FUNCTION(odbc_execute)
} }
if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) { if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) {
php_error(E_WARNING,"Can't open file %s", filename); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't open file %s", filename);
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
for(i = 0; i < result->numparams; i++) { for(i = 0; i < result->numparams; i++) {
if (params[i].fp != -1) { if (params[i].fp != -1) {
@ -1147,10 +1137,6 @@ PHP_FUNCTION(odbc_cursor)
if (max_len > 0) { if (max_len > 0) {
cursorname = emalloc(max_len + 1); cursorname = emalloc(max_len + 1);
if (cursorname == NULL) {
php_error(E_WARNING,"Out of memory");
RETURN_FALSE;
}
rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len); rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
char state[6]; /* Not used */ char state[6]; /* Not used */
@ -1170,7 +1156,7 @@ PHP_FUNCTION(odbc_cursor)
RETVAL_STRING(cursorname,1); RETVAL_STRING(cursorname,1);
} }
} else { } else {
php_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state); php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
RETVAL_FALSE; RETVAL_FALSE;
} }
} else { } else {
@ -1200,7 +1186,7 @@ PHP_FUNCTION(odbc_data_source)
} }
if (zend_get_parameters_ex(2, &zv_conn, &zv_fetch_type) == FAILURE) { if (zend_get_parameters_ex(2, &zv_conn, &zv_fetch_type) == FAILURE) {
php_error(E_WARNING, "%s(): Unable to get parameters", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to get parameters");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1275,10 +1261,6 @@ PHP_FUNCTION(odbc_exec)
query = Z_STRVAL_PP(pv_query); query = Z_STRVAL_PP(pv_query);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -1392,7 +1374,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1545,7 +1527,7 @@ PHP_FUNCTION(odbc_fetch_into)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1645,7 +1627,7 @@ PHP_FUNCTION(solid_fetch_prev)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
rc = SQLFetchPrev(result->stmt); rc = SQLFetchPrev(result->stmt);
@ -1694,7 +1676,7 @@ PHP_FUNCTION(odbc_fetch_row)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1756,14 +1738,14 @@ PHP_FUNCTION(odbc_result)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if ((result->numcols == 0)) { if ((result->numcols == 0)) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
/* get field index if the field parameter was a string */ /* get field index if the field parameter was a string */
if (field != NULL) { if (field != NULL) {
if (result->values == NULL) { if (result->values == NULL) {
php_error(E_WARNING, "Result set contains no data"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Result set contains no data");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1775,13 +1757,13 @@ PHP_FUNCTION(odbc_result)
} }
if (field_ind < 0) { if (field_ind < 0) {
php_error(E_WARNING, "Field %s not found", field); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found", field);
RETURN_FALSE; RETURN_FALSE;
} }
} else { } else {
/* check for limits of field_ind if the field parameter was an int */ /* check for limits of field_ind if the field parameter was an int */
if (field_ind >= result->numcols || field_ind < 0) { if (field_ind >= result->numcols || field_ind < 0) {
php_error(E_WARNING, "Field index is larger than the number of fields"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index is larger than the number of fields");
RETURN_FALSE; RETURN_FALSE;
} }
} }
@ -1822,10 +1804,6 @@ PHP_FUNCTION(odbc_result)
/* For char data, the length of the returned string will be longreadlen - 1 */ /* For char data, the length of the returned string will be longreadlen - 1 */
fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen;
field = emalloc(fieldsize); field = emalloc(fieldsize);
if (!field) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
/* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0. /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0.
* For binary data it is truncated to fieldsize bytes. * For binary data it is truncated to fieldsize bytes.
@ -1866,10 +1844,7 @@ PHP_FUNCTION(odbc_result)
/* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */ /* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */
fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095; fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095;
if ((field = emalloc(fieldsize)) == NULL) { field = emalloc(fieldsize);
php_error(E_WARNING,"Out of memory");
RETURN_FALSE;
}
/* Call SQLGetData() until SQL_SUCCESS is returned */ /* Call SQLGetData() until SQL_SUCCESS is returned */
while(1) { while(1) {
@ -1926,7 +1901,7 @@ PHP_FUNCTION(odbc_result_all)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
#ifdef HAVE_SQL_EXTENDED_FETCH #ifdef HAVE_SQL_EXTENDED_FETCH
@ -2218,11 +2193,6 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
len = strlen(db) + strlen(uid) + strlen(pwd) + sizeof(ODBC_TYPE) + 5; len = strlen(db) + strlen(uid) + strlen(pwd) + sizeof(ODBC_TYPE) + 5;
hashed_details = emalloc(len); hashed_details = emalloc(len);
if (hashed_details == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
hashed_len = sprintf(hashed_details, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt); hashed_len = sprintf(hashed_details, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt);
/* FIXME the idea of checking to see if our connection is already persistent /* FIXME the idea of checking to see if our connection is already persistent
@ -2492,17 +2462,17 @@ PHP_FUNCTION(odbc_field_name)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_PP(pv_num) > result->numcols) { if (Z_LVAL_PP(pv_num) > result->numcols) {
php_error(E_WARNING, "Field index larger than number of fields"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_PP(pv_num) < 1) { if (Z_LVAL_PP(pv_num) < 1) {
php_error(E_WARNING, "Field numbering starts at 1"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2528,17 +2498,17 @@ PHP_FUNCTION(odbc_field_type)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_PP(pv_num) > result->numcols) { if (Z_LVAL_PP(pv_num) > result->numcols) {
php_error(E_WARNING, "Field index larger than number of fields"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index larger than number of fields");
RETURN_FALSE; RETURN_FALSE;
} }
if (Z_LVAL_PP(pv_num) < 1) { if (Z_LVAL_PP(pv_num) < 1) {
php_error(E_WARNING, "Field numbering starts at 1"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field numbering starts at 1");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2581,7 +2551,7 @@ PHP_FUNCTION(odbc_field_num)
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (result->numcols == 0) { if (result->numcols == 0) {
php_error(E_WARNING, "No tuples available at this result index"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2745,7 +2715,7 @@ PHP_FUNCTION(odbc_setoption)
case 1: /* SQLSetConnectOption */ case 1: /* SQLSetConnectOption */
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
if (conn->persistent) { if (conn->persistent) {
php_error(E_WARNING, "Unable to set option for persistent connection"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to set option for persistent connection");
RETURN_FALSE; RETURN_FALSE;
} }
rc = SQLSetConnectOption(conn->hdbc, (unsigned short)(Z_LVAL_PP(pv_opt)), Z_LVAL_PP(pv_val)); rc = SQLSetConnectOption(conn->hdbc, (unsigned short)(Z_LVAL_PP(pv_opt)), Z_LVAL_PP(pv_val));
@ -2811,10 +2781,6 @@ PHP_FUNCTION(odbc_tables)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -2899,10 +2865,6 @@ PHP_FUNCTION(odbc_columns)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -2978,10 +2940,6 @@ PHP_FUNCTION(odbc_columnprivileges)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3076,10 +3034,6 @@ PHP_FUNCTION(odbc_foreignkeys)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3155,10 +3109,6 @@ PHP_FUNCTION(odbc_gettypeinfo)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3227,10 +3177,6 @@ PHP_FUNCTION(odbc_primarykeys)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3309,10 +3255,6 @@ PHP_FUNCTION(odbc_procedurecolumns)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3391,10 +3333,6 @@ PHP_FUNCTION(odbc_procedures)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3477,10 +3415,6 @@ PHP_FUNCTION(odbc_specialcolumns)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3562,10 +3496,6 @@ PHP_FUNCTION(odbc_statistics)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
@ -3640,10 +3570,6 @@ PHP_FUNCTION(odbc_tableprivileges)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
result = (odbc_result *)emalloc(sizeof(odbc_result)); result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
php_error(E_WARNING, "Out of memory");
RETURN_FALSE;
}
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {

View file

@ -315,7 +315,7 @@ PHP_FUNCTION(msg_receive)
MAKE_STD_ZVAL(tmp); MAKE_STD_ZVAL(tmp);
PHP_VAR_UNSERIALIZE_INIT(var_hash); PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&tmp, &p, p + result, &var_hash TSRMLS_CC)) { if (!php_var_unserialize(&tmp, &p, p + result, &var_hash TSRMLS_CC)) {
zend_error(E_WARNING, "%s(): message corrupted", get_active_function_name(TSRMLS_C)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "message corrupted");
RETVAL_FALSE; RETVAL_FALSE;
} }
REPLACE_ZVAL_VALUE(&out_message, tmp, 0); REPLACE_ZVAL_VALUE(&out_message, tmp, 0);

View file

@ -1659,11 +1659,11 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_
static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields) static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields)
{ {
php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
TSRMLS_FETCH();
if (XSLT_ERROR(handle)) { if (XSLT_ERROR(handle)) {
zval *argv[4]; /* Arguments to the error function */ zval *argv[4]; /* Arguments to the error function */
zval *retval; /* Return value from the error function */ zval *retval; /* Return value from the error function */
TSRMLS_FETCH();
/* Allocate and initialize */ /* Allocate and initialize */
MAKE_STD_ZVAL(argv[0]); MAKE_STD_ZVAL(argv[0]);