X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fmodule.c;h=08db8149c8db7ae22a65346237b1fe779dc8c453;hp=0edd74f365ca0c6c28c879cac13c1b10010d837e;hb=a0f437f26cd0f121ee911a55327a68a3544bf15f;hpb=a7ac1c0a3c855321f21682c127a4b707de33a303 diff --git a/src/module.c b/src/module.c index 0edd74f..08db814 100644 --- a/src/module.c +++ b/src/module.c @@ -166,19 +166,18 @@ static PHP_FUNCTION(psi_dump) { php_stream *s; zval *r = NULL; - int fd = STDOUT_FILENO; + struct psi_dump dump = {.fun = php_stream_printf}; if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "|r!", &r)) { return; } if (r) { php_stream_from_zval(s, r); - - if (SUCCESS != php_stream_cast(s, PHP_STREAM_AS_FD | PHP_STREAM_CAST_INTERNAL, (void **)&fd, 1)) { - RETURN_FALSE; - } + dump.ctx.hn = s; + } else { + dump.ctx.hn = php_stream_open_wrapper("php://output", "w", REPORT_ERRORS, NULL); } - psi_context_dump(PSI_G(context), fd); + psi_context_dump(&dump, PSI_G(context)); } ZEND_BEGIN_ARG_INFO_EX(ai_psi_validate, 0, 0, 1)