Skip to content

Commit bcc7ade

Browse files
committed
Move the ini setting from main to Zend/
1 parent e9fc164 commit bcc7ade

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

Zend/zend.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,20 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */
160160
}
161161
/* }}} */
162162

163+
static ZEND_INI_MH(OnSetThrowableStringParamMaxLen) /* {{{ */
164+
{
165+
zend_long i;
166+
167+
ZEND_ATOL(i, ZSTR_VAL(new_value));
168+
if (i >= 0 && i <= 1000000) {
169+
EG(exception_string_param_max_len) = i;
170+
return SUCCESS;
171+
} else {
172+
return FAILURE;
173+
}
174+
}
175+
/* }}} */
176+
163177
#if ZEND_DEBUG
164178
# define SIGNAL_CHECK_DEFAULT "1"
165179
#else
@@ -177,6 +191,7 @@ ZEND_INI_BEGIN()
177191
STD_ZEND_INI_BOOLEAN("zend.signal_check", SIGNAL_CHECK_DEFAULT, ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
178192
#endif
179193
STD_ZEND_INI_BOOLEAN("zend.exception_ignore_args", "0", ZEND_INI_ALL, OnUpdateBool, exception_ignore_args, zend_executor_globals, executor_globals)
194+
STD_ZEND_INI_ENTRY("zend.exception_string_param_max_len", "15", ZEND_INI_ALL, OnSetThrowableStringParamMaxLen, exception_string_param_max_len, zend_executor_globals, executor_globals)
180195
ZEND_INI_END()
181196

182197
ZEND_API size_t zend_vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */

Zend/zend_exceptions.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "zend_dtrace.h"
2929
#include "zend_smart_str.h"
3030
#include "zend_exceptions_arginfo.h"
31-
#include "php_globals.h"
3231

3332
ZEND_API zend_class_entry *zend_ce_throwable;
3433
ZEND_API zend_class_entry *zend_ce_exception;
@@ -483,8 +482,8 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
483482
break;
484483
case IS_STRING:
485484
smart_str_appendc(str, '\'');
486-
smart_str_append_escaped(str, Z_STRVAL_P(arg), MIN(Z_STRLEN_P(arg), PG(exception_string_param_max_len)));
487-
if (Z_STRLEN_P(arg) > PG(exception_string_param_max_len)) {
485+
smart_str_append_escaped(str, Z_STRVAL_P(arg), MIN(Z_STRLEN_P(arg), EG(exception_string_param_max_len)));
486+
if (Z_STRLEN_P(arg) > EG(exception_string_param_max_len)) {
488487
smart_str_appends(str, "...', ");
489488
} else {
490489
smart_str_appends(str, "', ");

Zend/zend_globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ struct _zend_executor_globals {
241241
HashTable weakrefs;
242242

243243
zend_bool exception_ignore_args;
244+
zend_long exception_string_param_max_len;
244245

245246
zend_get_gc_buffer get_gc_buffer;
246247

main/main.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,6 @@ static PHP_INI_MH(OnSetSerializePrecision)
260260
}
261261
/* }}} */
262262

263-
/* {{{ PHP_INI_MH
264-
*/
265-
static PHP_INI_MH(OnSetThrowableStringParamMaxLen)
266-
{
267-
zend_long i;
268-
269-
ZEND_ATOL(i, ZSTR_VAL(new_value));
270-
if (i >= 0 && i <= 1000000) {
271-
PG(exception_string_param_max_len) = i;
272-
return SUCCESS;
273-
} else {
274-
return FAILURE;
275-
}
276-
}
277-
/* }}} */
278-
279263
/* {{{ PHP_INI_MH */
280264
static PHP_INI_MH(OnChangeMemoryLimit)
281265
{
@@ -719,7 +703,6 @@ PHP_INI_BEGIN()
719703
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
720704
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals)
721705
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
722-
STD_PHP_INI_ENTRY("zend.exception_string_param_max_len", "15", PHP_INI_ALL, OnSetThrowableStringParamMaxLen, exception_string_param_max_len, php_core_globals, core_globals)
723706

724707
STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals)
725708
STD_PHP_INI_ENTRY("serialize_precision", "-1", PHP_INI_ALL, OnSetSerializePrecision, serialize_precision, php_core_globals, core_globals)

main/php_globals.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ struct _php_core_globals {
167167
char *syslog_ident;
168168
zend_bool have_called_openlog;
169169
zend_long syslog_filter;
170-
171-
zend_long exception_string_param_max_len;
172170
};
173171

174172

0 commit comments

Comments
 (0)