Skip to content

Commit abd3b15

Browse files
author
Sterling Hughes
committed
Making logging optional.
1 parent 5e99993 commit abd3b15

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ext/xslt/sablot.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,15 @@ PHP_FUNCTION(xslt_set_log)
436436
WRONG_PARAM_COUNT;
437437
}
438438
ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
439-
convert_to_string_ex(logfile);
440439

440+
if (Z_TYPE_PP(logfile) == IS_LONG) {
441+
XSLT_LOG(handle).do_log = Z_LVAL_PP(logfile);
442+
RETURN_NULL();
443+
}
444+
else {
445+
convert_to_string_ex(logfile);
446+
}
447+
441448
/* If the log file already exists, free it */
442449
if (XSLT_LOG(handle).path) {
443450
efree(XSLT_LOG(handle).path);
@@ -1255,6 +1262,9 @@ static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_
12551262
char msgformat[] = "Sablotron Message on line %s, level %s: %s\n"; /* Message format */
12561263
int error = 0; /* Error container */
12571264

1265+
if (!XSLT_LOG(handle).do_log)
1266+
return 0;
1267+
12581268
/* Parse the error array */
12591269
/* Loop through the error array */
12601270
if (fields) {

0 commit comments

Comments
 (0)