mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
* honor track_errors ini setting in php_verror()
This commit is contained in:
parent
60febe2890
commit
cd72343bb3
1 changed files with 13 additions and 2 deletions
15
main/main.c
15
main/main.c
|
@ -406,8 +406,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
|
||||||
char *buffer = NULL, *docref_buf = NULL, *ref = NULL, *target = NULL;
|
char *buffer = NULL, *docref_buf = NULL, *ref = NULL, *target = NULL;
|
||||||
char *docref_target = "", *docref_root = "";
|
char *docref_target = "", *docref_root = "";
|
||||||
char *function, *p;
|
char *function, *p;
|
||||||
|
int buffer_len = 0;
|
||||||
|
|
||||||
vspprintf(&buffer, 0, format, args);
|
buffer_len = vspprintf(&buffer, 0, format, args);
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
if (docref && docref[0] == '#') {
|
if (docref && docref[0] == '#') {
|
||||||
docref_target = strchr(docref, '#');
|
docref_target = strchr(docref, '#');
|
||||||
|
@ -464,9 +465,19 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
|
||||||
docref = "Unknown";
|
docref = "Unknown";
|
||||||
php_error(type, "%s(%s): %s", docref, params, buffer);
|
php_error(type, "%s(%s): %s", docref, params, buffer);
|
||||||
}
|
}
|
||||||
|
if (PG(track_errors) && EG(active_symbol_table)) {
|
||||||
|
pval *tmp;
|
||||||
|
ALLOC_ZVAL(tmp);
|
||||||
|
INIT_PZVAL(tmp);
|
||||||
|
Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
|
||||||
|
Z_STRLEN_P(tmp) = buffer_len;
|
||||||
|
Z_TYPE_P(tmp) = IS_STRING;
|
||||||
|
zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
|
||||||
|
}
|
||||||
efree(buffer);
|
efree(buffer);
|
||||||
if (docref_buf)
|
if (docref_buf) {
|
||||||
efree(docref_buf);
|
efree(docref_buf);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "%s(%s): Out of memory", get_active_function_name(TSRMLS_C), params);
|
php_error(E_ERROR, "%s(%s): Out of memory", get_active_function_name(TSRMLS_C), params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue