php_error -> php_error_docref

This commit is contained in:
Marcus Boerger 2002-10-30 14:15:16 +00:00
parent 9250827af6
commit 328396920b
2 changed files with 20 additions and 21 deletions

View file

@ -38,7 +38,7 @@
#include <fcntl.h> #include <fcntl.h>
/* functions relating to handlers */ /* functions relating to handlers */
static void register_sax_handler_pair(zval **, zval **, zval **); static void register_sax_handler_pair(zval **, zval **, zval ** TSRMLS_DC);
/* Free processor */ /* Free processor */
static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC); static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
@ -248,7 +248,7 @@ PHP_FUNCTION(xslt_set_sax_handlers)
/* Convert the sax_handlers_p zval ** to a hash table we can process */ /* Convert the sax_handlers_p zval ** to a hash table we can process */
sax_handlers = HASH_OF(*sax_handlers_p); sax_handlers = HASH_OF(*sax_handlers_p);
if (!sax_handlers) { if (!sax_handlers) {
php_error(E_WARNING, "Expecting an array as the second argument to xslt_set_sax_handlers()"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expecting an array as the second argument");
return; return;
} }
@ -260,7 +260,7 @@ PHP_FUNCTION(xslt_set_sax_handlers)
key_type = zend_hash_get_current_key(sax_handlers, &string_key, &num_key, 0); key_type = zend_hash_get_current_key(sax_handlers, &string_key, &num_key, 0);
if (key_type == HASH_KEY_IS_LONG) { if (key_type == HASH_KEY_IS_LONG) {
convert_to_string_ex(handler); convert_to_string_ex(handler);
php_error(E_NOTICE, "Skipping numerical index %d (with value %s) in xslt_set_sax_handlers()", php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numerical index %d (with value %s)",
num_key, Z_STRVAL_PP(handler)); num_key, Z_STRVAL_PP(handler));
continue; continue;
} }
@ -270,21 +270,21 @@ PHP_FUNCTION(xslt_set_sax_handlers)
SEPARATE_ZVAL(handler); SEPARATE_ZVAL(handler);
register_sax_handler_pair(&XSLT_SAX(handle).doc_start, register_sax_handler_pair(&XSLT_SAX(handle).doc_start,
&XSLT_SAX(handle).doc_end, &XSLT_SAX(handle).doc_end,
handler); handler TSRMLS_CC);
} }
/* Element handlers, start of an element, and end of an element */ /* Element handlers, start of an element, and end of an element */
else if (strcasecmp(string_key, "element") == 0) { else if (strcasecmp(string_key, "element") == 0) {
SEPARATE_ZVAL(handler); SEPARATE_ZVAL(handler);
register_sax_handler_pair(&XSLT_SAX(handle).element_start, register_sax_handler_pair(&XSLT_SAX(handle).element_start,
&XSLT_SAX(handle).element_end, &XSLT_SAX(handle).element_end,
handler); handler TSRMLS_CC);
} }
/* Namespace handlers, start of a namespace, end of a namespace */ /* Namespace handlers, start of a namespace, end of a namespace */
else if (strcasecmp(string_key, "namespace") == 0) { else if (strcasecmp(string_key, "namespace") == 0) {
SEPARATE_ZVAL(handler); SEPARATE_ZVAL(handler);
register_sax_handler_pair(&XSLT_SAX(handle).namespace_start, register_sax_handler_pair(&XSLT_SAX(handle).namespace_start,
&XSLT_SAX(handle).namespace_end, &XSLT_SAX(handle).namespace_end,
handler); handler TSRMLS_CC);
} }
/* Comment handlers, called when a comment is reached */ /* Comment handlers, called when a comment is reached */
else if (strcasecmp(string_key, "comment") == 0) { else if (strcasecmp(string_key, "comment") == 0) {
@ -304,7 +304,7 @@ PHP_FUNCTION(xslt_set_sax_handlers)
} }
/* Invalid handler name, tsk, tsk, tsk :) */ /* Invalid handler name, tsk, tsk, tsk :) */
else { else {
php_error(E_WARNING, "Invalid option to xslt_set_sax_handlers(): %s", string_key); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option: %s", string_key);
} }
} }
} }
@ -332,7 +332,7 @@ PHP_FUNCTION(xslt_set_scheme_handlers)
scheme_handlers = HASH_OF(*scheme_handlers_p); scheme_handlers = HASH_OF(*scheme_handlers_p);
if (!scheme_handlers) { if (!scheme_handlers) {
php_error(E_WARNING, "2nd argument to xslt_set_scheme_handlers() must be an array"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument must be an array");
return; return;
} }
@ -344,7 +344,7 @@ PHP_FUNCTION(xslt_set_scheme_handlers)
key_type = zend_hash_get_current_key(scheme_handlers, &string_key, &num_key, 0); key_type = zend_hash_get_current_key(scheme_handlers, &string_key, &num_key, 0);
if (key_type == HASH_KEY_IS_LONG) { if (key_type == HASH_KEY_IS_LONG) {
php_error(E_NOTICE, "Numerical key %d (with value %s) being ignored in xslt_set_scheme_handlers()", php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Numerical key %d (with value %s) being ignored",
num_key, Z_STRVAL_PP(handler)); num_key, Z_STRVAL_PP(handler));
continue; continue;
} }
@ -371,7 +371,7 @@ PHP_FUNCTION(xslt_set_scheme_handlers)
} }
/* Invalid handler name */ /* Invalid handler name */
else { else {
php_error(E_WARNING, "%s() invalid option '%s', skipping", get_active_function_name(TSRMLS_C), string_key); php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid option '%s', skipping", string_key);
continue; continue;
} }
@ -795,7 +795,7 @@ static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
/* {{{ register_sax_handler_pair() /* {{{ register_sax_handler_pair()
Register a pair of sax handlers */ Register a pair of sax handlers */
static void register_sax_handler_pair(zval **handler1, zval **handler2, zval **handler) static void register_sax_handler_pair(zval **handler1, zval **handler2, zval **handler TSRMLS_DC)
{ {
zval **current; /* The current handler we're grabbing */ zval **current; /* The current handler we're grabbing */
@ -805,7 +805,7 @@ static void register_sax_handler_pair(zval **handler1, zval **handler2, zval **h
zval_add_ref(handler1); zval_add_ref(handler1);
} }
else { else {
php_error(E_WARNING, "Wrong format of arguments to xslt_set_sax_handlers()"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong format of arguments");
return; return;
} }
@ -815,7 +815,7 @@ static void register_sax_handler_pair(zval **handler1, zval **handler2, zval **h
zval_add_ref(handler2); zval_add_ref(handler2);
} }
else { else {
php_error(E_WARNING, "Wrong format of arguments to xslt_set_sax_handlers()"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong format of arguments");
return; return;
} }
} }
@ -1452,6 +1452,7 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_
char *msgbuf = NULL; /* Message buffer */ char *msgbuf = NULL; /* Message buffer */
char msgformat[] = "Sablotron Message on line %s, level %s: %s\n"; /* Message format */ char msgformat[] = "Sablotron Message on line %s, level %s: %s\n"; /* Message format */
int error = 0; /* Error container */ int error = 0; /* Error container */
TSRMLS_FETCH();
if (!XSLT_LOG(handle).do_log) if (!XSLT_LOG(handle).do_log)
return 0; return 0;
@ -1495,7 +1496,7 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_
/* Haven't seen this yet, but turning it on during dev, to see /* Haven't seen this yet, but turning it on during dev, to see
what we can encounter -- MRS what we can encounter -- MRS
else { else {
php_error(E_WARNING, "Got key %s with val %s", key, val); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Got key %s with val %s", key, val);
} }
*/ */
@ -1548,7 +1549,7 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_
O_WRONLY|O_CREAT|O_APPEND, O_WRONLY|O_CREAT|O_APPEND,
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR); S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR);
if (XSLT_LOG(handle).fd == -1) { if (XSLT_LOG(handle).fd == -1) {
php_error(E_WARNING, "Cannot open log file, %s [%d]: %s", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open log file, %s [%d]: %s",
XSLT_LOG(handle).path, errno, strerror(errno)); XSLT_LOG(handle).path, errno, strerror(errno));
XSLT_LOG(handle).fd = 0; XSLT_LOG(handle).fd = 0;
} }
@ -1563,7 +1564,7 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_
/* Write the error to the file */ /* Write the error to the file */
error = write(XSLT_LOG(handle).fd, msgbuf, strlen(msgbuf)); error = write(XSLT_LOG(handle).fd, msgbuf, strlen(msgbuf));
if (error == -1) { if (error == -1) {
php_error(E_WARNING, "Cannot write data to log file, %s, with fd, %d [%d]: %s", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write data to log file, %s, with fd, %d [%d]: %s",
(XSLT_LOG(handle).path ? XSLT_LOG(handle).path : "stderr"), (XSLT_LOG(handle).path ? XSLT_LOG(handle).path : "stderr"),
XSLT_LOG(handle).fd, XSLT_LOG(handle).fd,
errno, errno,

View file

@ -92,8 +92,7 @@ extern void xslt_make_array(zval **zarr, char ***carr)
arr = HASH_OF(*zarr); arr = HASH_OF(*zarr);
if (! arr) { if (! arr) {
php_error(E_WARNING, "Invalid argument or parameter array to %s", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument or parameter array");
get_active_function_name(TSRMLS_C));
return; return;
} }
@ -111,8 +110,7 @@ extern void xslt_make_array(zval **zarr, char ***carr)
type = zend_hash_get_current_key(arr, &string_key, &num_key, 0); type = zend_hash_get_current_key(arr, &string_key, &num_key, 0);
if (type == HASH_KEY_IS_LONG) { if (type == HASH_KEY_IS_LONG) {
php_error(E_WARNING, "Invalid key value for argument or parameter array to %s", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid key value for argument or parameter array");
get_active_function_name(TSRMLS_C));
/* Make the next index NULL, so it signals the end of the array /* Make the next index NULL, so it signals the end of the array
this will protect against invalid arrays, like: this will protect against invalid arrays, like:
array('foo'=>'bar', 'foobarred', 'oops') */ array('foo'=>'bar', 'foobarred', 'oops') */
@ -252,7 +250,7 @@ extern void xslt_call_function(char *name,
} }
if (error == FAILURE) { if (error == FAILURE) {
php_error(E_WARNING, "Cannot call the %s handler: %s", php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the %s handler: %s",
name, Z_STRVAL_P(function)); name, Z_STRVAL_P(function));
} }