diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-01-18 21:31:11 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-01-18 21:31:11 +0000 |
commit | aebb39b0143f6f49edafc6159e9b7a3345833618 (patch) | |
tree | ed4f68fa425d205828d78a8a81e688d381a02413 /ext | |
parent | b2ecf477550ab799c82d65e9eddd5260865556bf (diff) | |
download | php-git-aebb39b0143f6f49edafc6159e9b7a3345833618.tar.gz |
Changed php_error to php_error_docref.
Thanks to Marcus Börger for writing a script that significantly simplifies
this process.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/curl/interface.c | 27 | ||||
-rw-r--r-- | ext/cyrus/cyrus.c | 20 | ||||
-rw-r--r-- | ext/ldap/ldap.c | 68 | ||||
-rw-r--r-- | ext/mnogosearch/php_mnogo.c | 58 | ||||
-rw-r--r-- | ext/msession/msession.c | 48 | ||||
-rw-r--r-- | ext/msql/php_msql.c | 28 | ||||
-rw-r--r-- | ext/mssql/php_mssql.c | 2 | ||||
-rw-r--r-- | ext/odbc/birdstep.c | 75 | ||||
-rw-r--r-- | ext/odbc/php_odbc.c | 134 | ||||
-rw-r--r-- | ext/sysvmsg/sysvmsg.c | 2 | ||||
-rw-r--r-- | ext/xslt/sablot.c | 2 |
11 files changed, 181 insertions, 283 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index a4118dcb85..8602e529d4 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -400,8 +400,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) t->func, retval, 2, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_WRITEFUNCTION", - get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the CURLOPT_WRITEFUNCTION"); length = -1; } else { @@ -455,8 +454,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) t->func, retval, 3, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION", - get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); length = -1; } else { @@ -515,8 +513,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx t->func, retval, 2, argv TSRMLS_CC); if (error == FAILURE) { - php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_HEADERFUNCTION", - get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the CURLOPT_HEADERFUNCTION"); length = -1; } else { @@ -560,13 +557,12 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen) func, retval, 2, argv TSRMLS_CC); 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; } else { if (Z_STRLEN_P(retval) > buflen) { - php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle", - get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle"); ret = -1; } else { @@ -687,7 +683,7 @@ PHP_FUNCTION(curl_init) ch->cp = curl_easy_init(); 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; } @@ -924,9 +920,7 @@ PHP_FUNCTION(curl_setopt) postfields = HASH_OF(*zvalue); if (! postfields) { - php_error(E_WARNING, - "%s(): Couldn't get HashTable in CURLOPT_POSTFIELDS", - get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS"); RETURN_FALSE; } @@ -988,9 +982,7 @@ PHP_FUNCTION(curl_setopt) ph = HASH_OF(*zvalue); if (!ph) { - php_error(E_WARNING, - "%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)); + 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"); RETURN_FALSE; } @@ -1006,8 +998,7 @@ PHP_FUNCTION(curl_setopt) slist = curl_slist_append(slist, indiv); if (! slist) { efree(indiv); - php_error(E_WARNING, "%s(): Couldn't build curl_slist", - get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't build curl_slist"); RETURN_FALSE; } zend_llist_add_element(&ch->to_free.str, &indiv); diff --git a/ext/cyrus/cyrus.c b/ext/cyrus/cyrus.c index 5e659f4998..dfea22ee70 100644 --- a/ext/cyrus/cyrus.c +++ b/ext/cyrus/cyrus.c @@ -108,7 +108,9 @@ PHP_MINFO_FUNCTION(cyrus) 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]]]) @@ -167,11 +169,11 @@ PHP_FUNCTION(cyrus_connect) break; 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; 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; } @@ -285,7 +287,7 @@ PHP_FUNCTION(cyrus_authenticate) if (! user) { struct passwd *pwd = getpwuid(getuid()); 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; } @@ -358,8 +360,7 @@ static void cyrus_generic_callback(struct imclient *client, if (call_user_function_ex(EG(function_table), NULL, callback->function, &retval, 4, argv, 0, NULL TSRMLS_CC) == FAILURE) { - php_error(E_WARNING, "%s(): Couldn't call the %s handler", - get_active_function_name(TSRMLS_C), callback->trigger); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't call the %s handler", callback->trigger); } zval_ptr_dtor(argv[0]); @@ -397,8 +398,7 @@ PHP_FUNCTION(cyrus_bind) hash = HASH_OF(*z_callback); if (! hash) { - php_error(E_WARNING, - "%s(): Second argument must be an array or object", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument must be an array or object"); RETURN_FALSE; } @@ -425,12 +425,12 @@ PHP_FUNCTION(cyrus_bind) } 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; } 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; } diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index d79a2af171..96adc911d3 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -374,7 +374,7 @@ PHP_FUNCTION(ldap_connect) #endif 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; } @@ -390,7 +390,7 @@ PHP_FUNCTION(ldap_connect) rc = ldap_initialize(&ldap, host); if (rc != LDAP_SUCCESS) { 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; } } else { @@ -408,7 +408,7 @@ PHP_FUNCTION(ldap_connect) if (ssl) { if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) { 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; } } @@ -458,7 +458,7 @@ PHP_FUNCTION(ldap_bind) 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) { - 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; } else { RETURN_TRUE; @@ -559,19 +559,19 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) case 4 : 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; } num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs)); 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; } for(i=0; i<num_attribs; i++) { 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); 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)); 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) { 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) { nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn)); 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) { 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) { nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter)); 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) { efree(ldap_attrs); } @@ -736,15 +736,15 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) && errno != LDAP_REFERRAL #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; } else { 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 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 @@ -1097,7 +1097,7 @@ PHP_FUNCTION(ldap_get_values) attribute = Z_STRVAL_PP(attr); 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; } @@ -1137,7 +1137,7 @@ PHP_FUNCTION(ldap_get_values_len) attribute = Z_STRVAL_PP(attr); 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; } @@ -1264,7 +1264,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } 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; } @@ -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) { ldap_mods[i]->mod_type = estrdup(attribute); } 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 */ while (i >= 0) { efree(ldap_mods[i--]); @@ -1322,7 +1322,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } else { for(j=0; j < num_values; j++) { 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_attribs = i + 1; 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 */ if (is_full_add == 1) { 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; } else RETVAL_TRUE; } else { 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; } else RETVAL_TRUE; } @@ -1422,7 +1422,7 @@ PHP_FUNCTION(ldap_delete) ldap_dn = Z_STRVAL_PP(dn); 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; } @@ -1517,7 +1517,7 @@ PHP_FUNCTION(ldap_compare) 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); } @@ -1540,12 +1540,12 @@ PHP_FUNCTION(ldap_sort) 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) { - 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; } 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; } @@ -1700,7 +1700,7 @@ PHP_FUNCTION(ldap_set_option) char error=0; 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; } ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls)); @@ -1709,12 +1709,12 @@ PHP_FUNCTION(ldap_set_option) zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval)); while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) { 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; break; } 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; break; } @@ -1785,7 +1785,7 @@ PHP_FUNCTION(ldap_parse_result) NULL /* &serverctrls */, 0 ); 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; } @@ -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); #else 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; } /* 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); 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; } else { 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? */ 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; } @@ -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); zval_ptr_dtor(&cb_retval); } 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; } zval_dtor(cb_url); @@ -2045,7 +2045,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) /* callable? */ 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); RETURN_FALSE; } @@ -2098,7 +2098,7 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way) RETVAL_STRINGL(ldap_buf, ldap_len, 1); free(ldap_buf); } 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; } diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c index 0c0f7023e6..a508b4a4be 100644 --- a/ext/mnogosearch/php_mnogo.c +++ b/ext/mnogosearch/php_mnogo.c @@ -471,7 +471,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent) #if UDM_VERSION_ID <= 30207 Env->errcode=1; #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; } @@ -524,7 +524,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent) #if UDM_VERSION_ID <= 30207 Env->errcode=1; #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; } Agent=UdmAgentInit(NULL,Env,0); @@ -626,7 +626,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) case UDM_MODE_PHRASE: #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; #else Agent->search_mode=UDM_MODE_PHRASE; @@ -639,7 +639,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #else Agent->search_mode=UDM_MODE_ALL; #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; break; } @@ -685,7 +685,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #else Agent->word_match=UDM_MATCH_WORD; #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; break; } @@ -720,7 +720,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #else UdmReplaceStrVar(Agent->Conf->vars,"Cache","no",UDM_VARSRC_GLOBAL); #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; break; } @@ -758,7 +758,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #else UdmReplaceStrVar(Agent->Conf->vars,"TrackQuery","no",UDM_VARSRC_GLOBAL); #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; break; } @@ -777,7 +777,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) break; 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; break; } @@ -815,7 +815,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #else UdmAddIntVar(Agent->Conf->vars, "IspellUsePrefixes", 1, UDM_VARSRC_GLOBAL); #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; break; } @@ -872,7 +872,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) case UDM_PARAM_SYNONYM: 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; #if UDM_VERSION_ID >= 30204 } else UdmSynonymListSort(&(Agent->Conf->Synonyms)); @@ -924,7 +924,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #else if (UdmFileLoadStopList(Agent->Conf,val)) { #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; } break; @@ -991,7 +991,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) break; 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; break; } @@ -1040,7 +1040,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) break; 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; break; } @@ -1065,7 +1065,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) break; 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; break; } @@ -1074,7 +1074,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) #endif 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; break; } @@ -1168,12 +1168,12 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data) #endif 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; } #else 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; } @@ -1189,12 +1189,12 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data) #endif 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; } #else 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; } #endif @@ -1202,7 +1202,7 @@ DLEXPORT PHP_FUNCTION(udm_load_ispell_data) 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; break; } @@ -1336,7 +1336,7 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit) Z_TYPE(stl_info)=2; stl_info.t2=(time_t)(atol(edate+1)); } 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; } @@ -1346,7 +1346,7 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit) #endif break; 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; break; } @@ -1666,7 +1666,7 @@ DLEXPORT PHP_FUNCTION(udm_make_excerpt) RETURN_FALSE; } }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; } @@ -1711,12 +1711,12 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param_ex) Agent->Conf->bcs=UdmGetCharSet(charset); } else if (!strcasecmp(var,"Synonym")) { 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; } else UdmSynonymListSort(&(Agent->Conf->Synonyms)); } else if (!strcasecmp(var,"Stopwordfile")) { 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; } } 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); } 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; } } @@ -1984,12 +1984,12 @@ DLEXPORT PHP_FUNCTION(udm_get_res_field) #endif 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; break; } }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; } } @@ -2106,7 +2106,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param) break; 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; break; } diff --git a/ext/msession/msession.c b/ext/msession/msession.c index 1cafb9a339..cdbd7424be 100644 --- a/ext/msession/msession.c +++ b/ext/msession/msession.c @@ -59,8 +59,8 @@ /* Test if system is OK fror use. */ /* Macros may be ugly, but I can globaly add debuging when needed. */ #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_END } else { php_error(E_WARNING, s_szNoInit, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } +#define IFCONNECT_ENDVAL(V) } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szNoInit); return V; } +#define IFCONNECT_END } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, s_szNoInit); RETURN_FALSE; } #ifndef HAVE_PHP_SESSION #error HAVE_PHP_SESSION not defined @@ -117,8 +117,8 @@ ps_module ps_mod_msession = { #endif /* Static strings */ -static char s_szNoInit[]="%s(): Msession not initialized"; -static char s_szErrFmt[]="%s(): %s"; +static char s_szNoInit[]="Msession not initialized"; +static char s_szErrFmt[]="%s"; /* Per-process variables need by msession */ static char s_szdefhost[]="localhost"; @@ -354,7 +354,7 @@ int PHPMsessionSetData(const char *session, const char *data TSRMLS_DC) PHPDoRequest(&s_conn,&s_reqb); ret = (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; @@ -369,7 +369,7 @@ int PHPMsessionDestroy(const char *session TSRMLS_DC) PHPDoRequest(&s_conn,&s_reqb); ret = (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; IFCONNECT_ENDVAL(0) @@ -402,7 +402,7 @@ PHP_FUNCTION(msession_connect) } 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; } } @@ -458,7 +458,7 @@ PHP_FUNCTION(msession_create) } 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; } IFCONNECT_END @@ -506,7 +506,7 @@ PHP_FUNCTION(msession_lock) } 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; } @@ -614,7 +614,7 @@ PHP_FUNCTION(msession_unlock) } 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; } IFCONNECT_END @@ -655,7 +655,7 @@ PHP_FUNCTION(msession_set) } 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; } IFCONNECT_END @@ -695,7 +695,7 @@ PHP_FUNCTION(msession_get) } 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(); } IFCONNECT_END @@ -728,7 +728,7 @@ PHP_FUNCTION(msession_uniq) } 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(); } IFCONNECT_END @@ -761,7 +761,7 @@ PHP_FUNCTION(msession_randstr) } 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(); } IFCONNECT_END @@ -807,7 +807,7 @@ PHP_FUNCTION(msession_find) } 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(); } IFCONNECT_END @@ -840,7 +840,7 @@ PHP_FUNCTION(msession_list) { /* May this should be an error? */ 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(); } IFCONNECT_END @@ -891,7 +891,7 @@ PHP_FUNCTION(msession_get_array) else { 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(); } IFCONNECT_END @@ -977,7 +977,7 @@ PHP_FUNCTION(msession_set_array) PHPDoRequest(&s_conn,&s_reqb); 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); IFCONNECT_END } @@ -1024,7 +1024,7 @@ PHP_FUNCTION(msession_listvar) } 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(); } IFCONNECT_END @@ -1065,7 +1065,7 @@ PHP_FUNCTION(msession_timeout) } 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(); } IFCONNECT_END @@ -1098,7 +1098,7 @@ PHP_FUNCTION(msession_inc) } 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; } IFCONNECT_END @@ -1203,7 +1203,7 @@ PHP_FUNCTION(msession_plugin) } 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; } @@ -1253,7 +1253,7 @@ PHP_FUNCTION(msession_call) } 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; } IFCONNECT_END @@ -1347,7 +1347,7 @@ PS_CREATE_SID_FUNC(msession) } 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"); diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c index 956228d419..ddd97293cc 100644 --- a/ext/msql/php_msql.c +++ b/ext/msql/php_msql.c @@ -267,12 +267,12 @@ static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) list_entry *le; 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); RETURN_FALSE; } 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); 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 */ if (msql_stat(le->ptr)==NULL) { /* the link died */ 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); efree(hashed_details); 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) { - 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); 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); 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; } 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; } 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; } 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); 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; } 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); 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; } msqlDataSeek(msql_result,Z_LVAL_P(row)); @@ -818,7 +818,7 @@ PHP_FUNCTION(msql_result) i++; } 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)); efree(field_name); if (table_name) { @@ -836,7 +836,7 @@ PHP_FUNCTION(msql_result) convert_to_long(field); field_offset = Z_LVAL_P(field); 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; } break; @@ -1010,7 +1010,7 @@ PHP_FUNCTION(msql_data_seek) if (!msql_result || Z_LVAL_P(offset)<0 || 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; } msqlDataSeek(msql_result,Z_LVAL_P(offset)); @@ -1087,7 +1087,7 @@ PHP_FUNCTION(msql_fetch_field) if (field) { 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; } msqlFieldSeek(msql_result,Z_LVAL_P(field)); @@ -1130,7 +1130,7 @@ PHP_FUNCTION(msql_field_seek) RETURN_FALSE; } 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)); RETURN_FALSE; } @@ -1164,7 +1164,7 @@ static void php_msql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) } convert_to_long(field); 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; } msqlFieldSeek(msql_result,Z_LVAL_P(field)); diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 72b639b50c..b44deff3c6 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -102,7 +102,7 @@ ZEND_DECLARE_MODULE_GLOBALS(mssql) ZEND_GET_MODULE(mssql) #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) { diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c index 2185933c64..cd0e04d452 100644 --- a/ext/odbc/birdstep.c +++ b/ext/odbc/birdstep.c @@ -236,7 +236,7 @@ PHP_FUNCTION(birdstep_connect) long ind; 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; } 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); stat = SQLAllocConnect(henv,&hdbc); 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; } stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS); 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); RETURN_FALSE; } 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); php_birdstep_module.num_links++; RETURN_LONG(ind); @@ -284,7 +279,7 @@ PHP_FUNCTION(birdstep_close) convert_to_long(id); conn = birdstep_find_conn(list,Z_LVAL_P(id)); 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; } SQLDisconnect(conn->hdbc); @@ -314,26 +309,22 @@ PHP_FUNCTION(birdstep_exec) convert_to_long(ind); conn = birdstep_find_conn(list,Z_LVAL_P(ind)); 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; } convert_to_string(exec_str); query = Z_STRVAL_P(exec_str); 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); 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); RETURN_FALSE; } stat = SQLExecDirect(res->hstmt,query,SQL_NTS); 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); efree(res); RETURN_FALSE; @@ -341,7 +332,7 @@ PHP_FUNCTION(birdstep_exec) /* Success query */ stat = SQLNumResultCols(res->hstmt,&cols); 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); efree(res); RETURN_FALSE; @@ -349,7 +340,7 @@ PHP_FUNCTION(birdstep_exec) if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */ stat = SQLRowCount(res->hstmt,&rows); 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); efree(res); RETURN_FALSE; @@ -359,12 +350,6 @@ PHP_FUNCTION(birdstep_exec) RETURN_LONG(rows); } else { /* Was SELECT query */ 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; for ( i = 0; i < cols; i++ ) { SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME, @@ -412,7 +397,7 @@ PHP_FUNCTION(birdstep_fetch) convert_to_long(ind); res = birdstep_find_result(list,Z_LVAL_P(ind)); 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; } stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); @@ -422,7 +407,7 @@ PHP_FUNCTION(birdstep_fetch) RETURN_FALSE; } 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); birdstep_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; @@ -451,7 +436,7 @@ PHP_FUNCTION(birdstep_result) convert_to_long(ind); res = birdstep_find_result(list,Z_LVAL_P(ind)); 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; } if ( Z_TYPE_P(col) == IS_STRING ) { @@ -468,12 +453,12 @@ PHP_FUNCTION(birdstep_result) } } 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; } } else { 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; } } @@ -485,7 +470,7 @@ PHP_FUNCTION(birdstep_result) RETURN_FALSE; } 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); birdstep_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; @@ -501,10 +486,6 @@ PHP_FUNCTION(birdstep_result) l1: if ( !res->values[indx].value ) { 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, res->values[indx].value,4095,&res->values[indx].vallen); @@ -514,7 +495,7 @@ l1: RETURN_FALSE; } 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); birdstep_del_result(list,Z_LVAL_P(ind)); RETURN_FALSE; @@ -545,7 +526,7 @@ PHP_FUNCTION(birdstep_freeresult) convert_to_long(ind); res = birdstep_find_result(list,Z_LVAL_P(ind)); 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; } SQLFreeStmt(res->hstmt,SQL_DROP); @@ -568,12 +549,12 @@ PHP_FUNCTION(birdstep_autocommit) convert_to_long(id); conn = birdstep_find_conn(list,Z_LVAL_P(id)); 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; } stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON); 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_TRUE; @@ -594,12 +575,12 @@ PHP_FUNCTION(birdstep_off_autocommit) convert_to_long(id); conn = birdstep_find_conn(list,Z_LVAL_P(id)); 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; } stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF); 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_TRUE; @@ -620,12 +601,12 @@ PHP_FUNCTION(birdstep_commit) convert_to_long(id); conn = birdstep_find_conn(list,Z_LVAL_P(id)); 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; } stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT); 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_TRUE; @@ -646,12 +627,12 @@ PHP_FUNCTION(birdstep_rollback) convert_to_long(id); conn = birdstep_find_conn(list,Z_LVAL_P(id)); 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; } stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK); 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_TRUE; @@ -672,13 +653,13 @@ PHP_FUNCTION(birdstep_fieldname) convert_to_long(ind); res = birdstep_find_result(list,Z_LVAL_P(ind)); 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; } convert_to_long(col); indx = Z_LVAL_P(col); 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_STRING(res->values[indx].name,TRUE); @@ -698,7 +679,7 @@ PHP_FUNCTION(birdstep_fieldnum) convert_to_long(ind); res = birdstep_find_result(list,Z_LVAL_P(ind)); 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_LONG(res->numcols); diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 273ec51b95..367b9d8975 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -588,9 +588,9 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) memcpy(ODBCG(laststate), state, sizeof(state)); memcpy(ODBCG(lasterrormsg), errormsg, sizeof(errormsg)); 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 { - 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)); @@ -636,12 +636,6 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC) 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->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); 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; } 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; } 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; } @@ -850,10 +844,6 @@ PHP_FUNCTION(odbc_prepare) query = Z_STRVAL_PP(pv_query); result = (odbc_result *)emalloc(sizeof(odbc_result)); - if (result == NULL) { - php_error(E_WARNING, "Out of memory"); - RETURN_FALSE; - } result->numparams = 0; @@ -968,13 +958,13 @@ PHP_FUNCTION(odbc_execute) /* XXX check for already bound parameters*/ 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; } if (result->numparams > 0) { 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; } @@ -983,7 +973,7 @@ PHP_FUNCTION(odbc_execute) for(i = 1; i <= result->numparams; i++) { 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); efree(params); RETURN_FALSE; @@ -992,7 +982,7 @@ PHP_FUNCTION(odbc_execute) otype = (*tmp)->type; convert_to_string(*tmp); 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); efree(params); RETURN_FALSE; @@ -1025,7 +1015,7 @@ PHP_FUNCTION(odbc_execute) } 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); for(i = 0; i < result->numparams; i++) { if (params[i].fp != -1) { @@ -1147,10 +1137,6 @@ PHP_FUNCTION(odbc_cursor) if (max_len > 0) { 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); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { char state[6]; /* Not used */ @@ -1170,7 +1156,7 @@ PHP_FUNCTION(odbc_cursor) RETVAL_STRING(cursorname,1); } } 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; } } else { @@ -1200,7 +1186,7 @@ PHP_FUNCTION(odbc_data_source) } 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; } @@ -1275,10 +1261,6 @@ PHP_FUNCTION(odbc_exec) query = Z_STRVAL_PP(pv_query); 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)); 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); 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; } @@ -1545,7 +1527,7 @@ PHP_FUNCTION(odbc_fetch_into) ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); 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; } @@ -1645,7 +1627,7 @@ PHP_FUNCTION(solid_fetch_prev) ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); 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; } 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); 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; } @@ -1756,14 +1738,14 @@ PHP_FUNCTION(odbc_result) ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); 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; } /* get field index if the field parameter was a string */ if (field != 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; } @@ -1775,13 +1757,13 @@ PHP_FUNCTION(odbc_result) } 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; } } else { /* check for limits of field_ind if the field parameter was an int */ 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; } } @@ -1822,10 +1804,6 @@ PHP_FUNCTION(odbc_result) /* For char data, the length of the returned string will be longreadlen - 1 */ fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; 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. * 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) */ fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095; - if ((field = emalloc(fieldsize)) == NULL) { - php_error(E_WARNING,"Out of memory"); - RETURN_FALSE; - } + field = emalloc(fieldsize); /* Call SQLGetData() until SQL_SUCCESS is returned */ while(1) { @@ -1926,7 +1901,7 @@ PHP_FUNCTION(odbc_result_all) ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); 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; } #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; 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); /* 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); 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; } 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; } 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; } @@ -2528,17 +2498,17 @@ PHP_FUNCTION(odbc_field_type) ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); 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; } 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; } 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; } @@ -2581,7 +2551,7 @@ PHP_FUNCTION(odbc_field_num) ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); 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; } @@ -2745,7 +2715,7 @@ PHP_FUNCTION(odbc_setoption) case 1: /* SQLSetConnectOption */ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn); 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; } 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); 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); 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)); if (rc == SQL_INVALID_HANDLE) { diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index 1c03f8146e..e038538fc3 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -315,7 +315,7 @@ PHP_FUNCTION(msg_receive) MAKE_STD_ZVAL(tmp); PHP_VAR_UNSERIALIZE_INIT(var_hash); 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; } REPLACE_ZVAL_VALUE(&out_message, tmp, 0); diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c index b365b6732b..35e7c071a9 100644 --- a/ext/xslt/sablot.c +++ b/ext/xslt/sablot.c @@ -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) { php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */ + TSRMLS_FETCH(); if (XSLT_ERROR(handle)) { zval *argv[4]; /* Arguments to the error function */ zval *retval; /* Return value from the error function */ - TSRMLS_FETCH(); /* Allocate and initialize */ MAKE_STD_ZVAL(argv[0]); |