diff --git a/processor/processor.m4 b/processor/processor.m4 index e286fe3..0172611 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -758,6 +758,7 @@ dnl }}} #endif #ifdef E_STRICT DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{ + DISPATCH(int, type) DISPATCH(uint, lineno) DISPATCH(int, error_len) PROC_STRING_L(error, error_len) diff --git a/utils.c b/utils.c index 5736527..ce3ec96 100644 --- a/utils.c +++ b/utils.c @@ -538,7 +538,28 @@ static void xc_sandbox_error_cb(int type, const char *error_filename, const uint sandbox = (xc_sandbox_t *) XG(sandbox); assert(sandbox != NULL); - if (type != E_STRICT) { + switch (type) { + case E_STRICT: +#ifdef E_DEPRECATED + case E_DEPRECATED: +#endif + if (sandbox->compilererror_cnt <= sandbox->compilererror_size) { + if (sandbox->compilererror_size) { + sandbox->compilererror_size += 16; + sandbox->compilererrors = erealloc(sandbox->compilererrors, sandbox->compilererror_size * sizeof(sandbox->compilererrors)); + } + else { + sandbox->compilererror_size = 16; + sandbox->compilererrors = emalloc(sandbox->compilererror_size * sizeof(sandbox->compilererrors)); + } + } + compilererror = &sandbox->compilererrors[sandbox->compilererror_cnt++]; + compilererror->type = type; + compilererror->lineno = error_lineno; + compilererror->error_len = vspprintf(&compilererror->error, 0, format, args); + break; + + default: { /* give up, and user handler is not supported in this case */ zend_uint i; zend_uint orig_lineno = CG(zend_lineno); @@ -547,28 +568,15 @@ static void xc_sandbox_error_cb(int type, const char *error_filename, const uint for (i = 0; i < sandbox->compilererror_cnt; i ++) { compilererror = &sandbox->compilererrors[i]; CG(zend_lineno) = compilererror->lineno; - zend_error(E_STRICT, "%s", compilererror->error); + zend_error(type, "%s", compilererror->error); } CG(zend_lineno) = orig_lineno; sandbox->compilererror_cnt = 0; sandbox->orig_zend_error_cb(type, error_filename, error_lineno, format, args); - return; + break; } - - if (sandbox->compilererror_cnt <= sandbox->compilererror_size) { - if (sandbox->compilererror_size) { - sandbox->compilererror_size += 16; - sandbox->compilererrors = erealloc(sandbox->compilererrors, sandbox->compilererror_size * sizeof(sandbox->compilererrors)); - } - else { - sandbox->compilererror_size = 16; - sandbox->compilererrors = emalloc(sandbox->compilererror_size * sizeof(sandbox->compilererrors)); - } } - compilererror = &sandbox->compilererrors[sandbox->compilererror_cnt++]; - compilererror->lineno = error_lineno; - compilererror->error_len = vspprintf(&compilererror->error, 0, format, args); } /* }}} */ #endif @@ -816,7 +824,7 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t instal for (i = 0; i < sandbox->compilererror_cnt; i ++) { xc_compilererror_t *error = &sandbox->compilererrors[i]; CG(zend_lineno) = error->lineno; - zend_error(E_STRICT, "%s", error->error); + zend_error(error->type, "%s", error->error); } CG(zend_lineno) = 0; #endif diff --git a/xcache.c b/xcache.c index 2d5461b..6f87640 100644 --- a/xcache.c +++ b/xcache.c @@ -752,7 +752,7 @@ static zend_op_array *xc_entry_install(xc_entry_t *xce, zend_file_handle *h TSRM for (i = 0; i < p->compilererror_cnt; i ++) { xc_compilererror_t *error = &p->compilererrors[i]; CG(zend_lineno) = error->lineno; - zend_error(E_STRICT, "%s", error->error); + zend_error(error->type, "%s", error->error); } CG(zend_lineno) = 0; #endif diff --git a/xcache.h b/xcache.h index a86f7c8..f58bda6 100644 --- a/xcache.h +++ b/xcache.h @@ -290,6 +290,7 @@ typedef enum { XC_TYPE_PHP, XC_TYPE_VAR } xc_entry_type_t; typedef char xc_md5sum_t[16]; /* {{{ xc_compilererror_t */ typedef struct { + int type; uint lineno; int error_len; char *error;