Answer the question
In order to leave comments, you need to log in
Xdebug - tell me with a solution to the issue of displaying errors (xdebug_start_error_collection)
Hello PHP-habrapublic.
Again I start to disturb you because of the decision of thin questions of the correct programming.
This raises another interesting question for inquisitive PHP minds.
echo "before xdebug_start_error_collection\n";
xdebug_start_error_collection();
echo "after xdebug_start_error_collection\n";
echo $generate_notice; // переменная ранее не была объявлена, значит будет E_NOTICE
echo "after notice generate\n";
xdebug_get_collected_errors();
echo "after xdebug_get_collected_errors";
Answer the question
In order to leave comments, you need to log in
Gentlemen, it's a bug. As you can see from the code, the function does not fulfill its purpose, even the basic one - “hiding error data”, I can’t say anything about accumulation.
/* Display errors */
if (PG(display_errors) && !PG(during_request_startup)) {
char *printable_stack;
/* We need to see if we have an uncaught exception fatal error now */
if (type == E_ERROR && strncmp(buffer, "Uncaught exception", 18) == 0) {
xdebug_str str = {0, 0, NULL};
char *tmp_buf, *p;
/* find first new line */
p = strchr(buffer, '\n');
/* find last quote */
p = ((char *) zend_memrchr(buffer, '\'', p - buffer)) + 1;
/* Create new buffer */
tmp_buf = calloc(p - buffer + 1, 1);
strncpy(tmp_buf, buffer, p - buffer );
/* Append error */
xdebug_append_error_head(&str, PG(html_errors) TSRMLS_CC);
xdebug_append_error_description(&str, PG(html_errors), error_type_str, tmp_buf, error_filename, error_lineno TSRMLS_CC);
xdebug_append_printable_stack(&str, PG(html_errors) TSRMLS_CC);
xdebug_str_add(&str, XG(last_exception_trace), 0);
xdebug_append_error_footer(&str, PG(html_errors));
php_output_error(str.d TSRMLS_CC);
xdfree(str.d);
free(tmp_buf);
} else {
printable_stack = get_printable_stack(PG(html_errors), error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
php_output_error(printable_stack TSRMLS_CC);
xdfree(printable_stack);
}
}
if (XG(do_collect_errors)) {
char *printable_stack;
printable_stack = get_printable_stack(PG(html_errors), error_type_str, buffer, error_filename, error_lineno TSRMLS_CC);
xdebug_llist_insert_next(XG(collected_errors), XDEBUG_LLIST_TAIL(XG(collected_errors)), printable_stack);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question