#endif
len = regerror(err, re, NULL, 0);
if (len) {
+ TSRMLS_FETCH();
+
message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
if (!message) {
return; /* fail silently */
/* drop the message into place */
regerror(err, re, message + buf_len, len);
- php_error(E_WARNING, "%s", message);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
}
STR_FREE(buf);
/* allocate storage for (sub-)expression-matches */
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
- if (!subs) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg");
- RETURN_FALSE;
- }
/* actually execute the regular expression */
err = regexec(&re, string, re.re_nsub+1, subs, 0);
string_len = Z_STRLEN_PP(findin) + 1;
buf = emalloc(string_len);
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg");
- regfree(&re);
- efree(subs);
- RETURN_FALSE;
- }
zval_dtor(*array); /* start with clean array */
array_init(*array);
/* allocate storage for (sub-)expression-matches */
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
- if (!subs) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
- return ((char *) -1);
- }
/* start with a buffer that is twice the size of the stringo
we're doing replacements in */
buf_len = 2 * string_len + 1;
buf = emalloc(buf_len * sizeof(char));
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
- efree(subs);
- regfree(&re);
- return ((char *) -1);
- }
err = pos = 0;
buf[0] = '\0';
} else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
/* No more matches */
regfree(&re);
- php_error(E_WARNING, "Invalid Regular Expression to split()");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
zend_hash_destroy(Z_ARRVAL_P(return_value));
efree(Z_ARRVAL_P(return_value));
RETURN_FALSE;
zts = module_entry->zts;
}
- php_error(error_type,
+ php_error_docref(NULL TSRMLS_CC, error_type,
"%s: Unable to initialize module\n"
"Module compiled with module API=%d, debug=%d, thread-safety=%d\n"
"PHP compiled with module API=%d, debug=%d, thread-safety=%d\n"
larg0 = strlen(arg0);
if (strstr(arg0, "..")) {
- php_error(E_WARNING, "No '..' components allowed in path");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No '..' components allowed in path");
efree(arg0);
return FAILURE;
}
ua[ua_len] = 0;
php_stream_write(stream, ua, ua_len);
} else {
- php_error(E_WARNING, "Cannot construct User-agent header");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot construct User-agent header");
}
if (ua) {
{
char buf[1024];
char *class_name;
+ TSRMLS_FETCH();
class_name = php_lookup_class_name(ref->object, NULL, 0);
if (!class_name)
class_name = estrdup("unknown");
- snprintf(buf, 1023, INCOMPLETE_CLASS_MSG, class_name);
+ snprintf(buf, sizeof(buf)-1, INCOMPLETE_CLASS_MSG, class_name);
efree(class_name);
- php_error(error_type, "%s", buf);
+ php_error_docref(NULL TSRMLS_CC, error_type, "%s", buf);
}
/* }}} */
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hartmut@six.de> |
+ | Author: Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
*/
static int custom_levdist(char *str1, char *str2, char *callback_name)
{
- php_error(E_WARNING, "the general Levenshtein support is not there yet");
- /* not there yet */
+ TSRMLS_FETCH();
- return -1;
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The general Levenshtein support is not there yet");
+ /* not there yet */
+
+ return -1;
}
/* }}} */
ret = readlink(Z_STRVAL_PP(filename), buff, MAXPATHLEN-1);
if (ret == -1) {
- php_error(E_WARNING, "readlink failed (%s)", strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
/* Append NULL to the end of the string */
ret = VCWD_LSTAT(Z_STRVAL_PP(filename), &sb);
if (ret == -1) {
- php_error(E_WARNING, "Linkinfo failed (%s)", strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
RETURN_LONG(-1L);
}
if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ||
php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) )
{
- php_error(E_WARNING, "Unable to symlink to a URL");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to symlink to a URL");
RETURN_FALSE;
}
ret = symlink(dest_p, source_p);
#endif
if (ret == -1) {
- php_error(E_WARNING, "Symlink failed (%s)", strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ||
php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) )
{
- php_error(E_WARNING, "Unable to link to a URL");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to link to a URL");
RETURN_FALSE;
}
ret = link(dest_p, source_p);
#endif
if (ret == -1) {
- php_error(E_WARNING, "Link failed (%s)", strerror(errno));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
if (num > onum)
continue;
- php_error(E_WARNING, "base_to_long: number '%s' is too big to fit in long", s);
- return LONG_MAX;
+ {
+ TSRMLS_FETCH();
+
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s);
+ return LONG_MAX;
+ }
}
return num;
convert_to_long_ex(frombase);
convert_to_long_ex(tobase);
if (Z_LVAL_PP(frombase) < 2 || Z_LVAL_PP(frombase) > 36) {
- php_error(E_WARNING, "base_convert: invalid `from base' (%d)", Z_LVAL_PP(frombase));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `from base' (%d)", Z_LVAL_PP(frombase));
RETURN_FALSE;
}
if (Z_LVAL_PP(tobase) < 2 || Z_LVAL_PP(tobase) > 36) {
- php_error(E_WARNING, "base_convert: invalid `to base' (%d)", Z_LVAL_PP(tobase));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `to base' (%d)", Z_LVAL_PP(tobase));
RETURN_FALSE;
}
case 'X':
case '@':
if (arg < 0) {
- php_error(E_WARNING, "pack type %c: '*' ignored", code);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: '*' ignored", code);
arg = 1;
}
break;
efree(argv);
efree(formatcodes);
efree(formatargs);
- php_error(E_WARNING, "pack type %c: not enough arguments", code);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough arguments", code);
RETURN_FALSE;
}
efree(argv);
efree(formatcodes);
efree(formatargs);
- php_error(E_WARNING, "pack type %c: too few arguments", code);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: too few arguments", code);
RETURN_FALSE;
}
break;
efree(argv);
efree(formatcodes);
efree(formatargs);
- php_error(E_WARNING, "pack type %c: unknown format code", code);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: unknown format code", code);
RETURN_FALSE;
}
}
if (currentarg < argc) {
- php_error(E_WARNING, "pack %d arguments unused", (argc - currentarg));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d arguments unused", (argc - currentarg));
}
/* Calculate output length and upper bound while processing*/
outputpos -= arg;
if (outputpos < 0) {
- php_error(E_WARNING, "pack type %c: outside of string", code);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", code);
outputpos = 0;
}
break;
v = Z_STRVAL_PP(val);
outputpos--;
if(arg > Z_STRLEN_PP(val)) {
- php_error(E_WARNING, "pack type %c: not enough characters in string", code);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough characters in string", code);
arg = Z_STRLEN_PP(val);
}
} else if (n >= 'a' && n <= 'f') {
n -= ('a' - 10);
} else {
- php_error(E_WARNING, "pack type %c: illegal hex digit %c", code, n);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: illegal hex digit %c", code, n);
n = 0;
}
i = arg - 1; /* Break out of for loop */
if (arg >= 0) {
- php_error(E_WARNING, "pack type %c: outside of string", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
}
}
break;
if (arg <= inputlen) {
inputpos = arg;
} else {
- php_error(E_WARNING, "pack type %c: outside of string", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
}
i = arg - 1; /* Done, break out of for loop */
/* Reached end of input for '*' repeater */
break;
} else {
- php_error(E_WARNING, "pack type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
zval_dtor(return_value);
RETURN_FALSE;
}
#endif
len = regerror(err, re, NULL, 0);
if (len) {
+ TSRMLS_FETCH();
+
message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
if (!message) {
return; /* fail silently */
/* drop the message into place */
regerror(err, re, message + buf_len, len);
- php_error(E_WARNING, "%s", message);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
}
STR_FREE(buf);
/* allocate storage for (sub-)expression-matches */
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
- if (!subs) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg");
- RETURN_FALSE;
- }
/* actually execute the regular expression */
err = regexec(&re, string, re.re_nsub+1, subs, 0);
string_len = Z_STRLEN_PP(findin) + 1;
buf = emalloc(string_len);
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg");
- regfree(&re);
- efree(subs);
- RETURN_FALSE;
- }
zval_dtor(*array); /* start with clean array */
array_init(*array);
/* allocate storage for (sub-)expression-matches */
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1);
- if (!subs) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
- return ((char *) -1);
- }
/* start with a buffer that is twice the size of the stringo
we're doing replacements in */
buf_len = 2 * string_len + 1;
buf = emalloc(buf_len * sizeof(char));
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg_replace");
- efree(subs);
- regfree(&re);
- return ((char *) -1);
- }
err = pos = 0;
buf[0] = '\0';
} else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
/* No more matches */
regfree(&re);
- php_error(E_WARNING, "Invalid Regular Expression to split()");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
zend_hash_destroy(Z_ARRVAL_P(return_value));
efree(Z_ARRVAL_P(return_value));
RETURN_FALSE;
/* problem - cc */
/*
if (flags & SCAN_WIDTH) {
- php_error(E_WARNING, "field width may not be specified in %c conversion");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field width may not be specified in %c conversion");
goto error;
}
*/
}
break;
badSet:
- php_error(E_WARNING, "unmatched [ in format string");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unmatched [ in format string");
goto error;
default:
{
- php_error(E_WARNING, "bad scan conversion character \"%c\"", ch);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad scan conversion character \"%c\"", ch);
goto error;
}
}
}
for (i = 0; i < numVars; i++) {
if (nassign[i] > 1) {
- php_error(E_WARNING, "variable is assigned by multiple \"%n$\" conversion specifiers");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is assigned by multiple \"%n$\" conversion specifiers");
goto error;
} else if (!xpgSize && (nassign[i] == 0)) {
/*
* If the space is empty, and xpgSize is 0 (means XPG wasn't
* used, and/or numVars != 0), then too many vars were given
*/
- php_error(E_WARNING, "variable is not assigned by any conversion specifiers");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Variable is not assigned by any conversion specifiers");
goto error;
}
}
badIndex:
if (gotXpg) {
- php_error(E_WARNING, "\"%n$\" argument index out of range");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "\"%n$\" argument index out of range");
} else {
- php_error(E_WARNING, "different numbers of variable names and field specifiers");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Different numbers of variable names and field specifiers");
}
error:
/* Do some bounds checking since we are using a char array. */
if (prefix_len > 114) {
- php_error(E_WARNING, "The prefix to uniqid should not be more than 114 characters.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The prefix to uniqid should not be more than 114 characters.");
return;
}
#if HAVE_USLEEP && !defined(PHP_WIN32)
resource = php_url_parse(str);
if (resource == NULL) {
- php_error(E_WARNING, "unable to parse url (%s)", str);
+ php_error_docref1(NULL TSRMLS_CC, str, E_WARNING, "Unable to parse url");
RETURN_FALSE;
}
(void **) &name, &pos);
if (Z_TYPE_PP(name) != IS_STRING) {
- php_error(E_NOTICE, "__sleep should return an array only "
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
"containing the names of instance-variables to "
"serialize.");
/* we should still add element even if it's not OK,
php_var_serialize_class(buf, struc, retval_ptr,
var_hash TSRMLS_CC);
} else {
- php_error(E_NOTICE, "__sleep should return an array only "
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
"containing the names of instance-variables to "
"serialize.");
}
if (!php_var_unserialize(&return_value, &p, p + Z_STRLEN_PP(buf), &var_hash TSRMLS_CC)) {
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
zval_dtor(return_value);
- php_error(E_NOTICE, "unserialize() failed at offset %d of %d bytes", p - Z_STRVAL_PP(buf), Z_STRLEN_PP(buf));
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %d of %d bytes", p - Z_STRVAL_PP(buf), Z_STRLEN_PP(buf));
RETURN_FALSE;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
} else {
- php_error(E_NOTICE, "argument passed to unserialize() is not an string");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Argument is not an string");
RETURN_FALSE;
}
}