Lines Matching refs:handler
55 static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_ou…
56 static inline bool php_output_handler_append(php_output_handler *handler, const php_output_buffer *…
57 static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry);
178 php_output_handler **handler = NULL; in php_output_deactivate() local
189 while ((handler = zend_stack_top(&OG(handlers)))) { in php_output_deactivate()
190 php_output_handler_free(handler); in php_output_deactivate()
400 php_output_handler *handler; in php_output_start_default() local
402 …handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_outpu… in php_output_start_default()
403 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_default()
406 php_output_handler_free(&handler); in php_output_start_default()
415 php_output_handler *handler; in php_output_start_devnull() local
417 …handler = php_output_handler_create_internal(ZEND_STRL(php_output_devnull_handler_name), php_outpu… in php_output_start_devnull()
418 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_devnull()
421 php_output_handler_free(&handler); in php_output_start_devnull()
430 php_output_handler *handler; in php_output_start_user() local
433 handler = php_output_handler_create_user(output_handler, chunk_size, flags); in php_output_start_user()
435 …handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_outpu… in php_output_start_user()
437 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_user()
440 php_output_handler_free(&handler); in php_output_start_user()
449 php_output_handler *handler; in php_output_start_internal() local
451 …handler = php_output_handler_create_internal(name, name_len, php_output_handler_compat_func, chunk… in php_output_start_internal()
452 php_output_handler_set_context(handler, output_handler, NULL); in php_output_start_internal()
453 if (SUCCESS == php_output_handler_start(handler)) { in php_output_start_internal()
456 php_output_handler_free(&handler); in php_output_start_internal()
467 php_output_handler *handler = NULL; in php_output_handler_create_user() local
473 …handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_outpu… in php_output_handler_create_user()
477 handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags); in php_output_handler_create_user()
484 …handler = php_output_handler_init(handler_name, chunk_size, PHP_OUTPUT_HANDLER_ABILITY_FLAGS(flags… in php_output_handler_create_user()
486 handler->func.user = user; in php_output_handler_create_user()
499 return handler; in php_output_handler_create_user()
507 php_output_handler *handler; in php_output_handler_create_internal() local
510 …handler = php_output_handler_init(str, chunk_size, PHP_OUTPUT_HANDLER_ABILITY_FLAGS(flags) | PHP_O… in php_output_handler_create_internal()
511 handler->func.internal = output_handler; in php_output_handler_create_internal()
514 return handler; in php_output_handler_create_internal()
520 PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(vo… in php_output_handler_set_context() argument
522 if (handler->dtor && handler->opaq) { in php_output_handler_set_context()
523 handler->dtor(handler->opaq); in php_output_handler_set_context()
525 handler->dtor = dtor; in php_output_handler_set_context()
526 handler->opaq = opaq; in php_output_handler_set_context()
532 PHPAPI zend_result php_output_handler_start(php_output_handler *handler) in php_output_handler_start() argument
537 if (php_output_lock_error(PHP_OUTPUT_HANDLER_START) || !handler) { in php_output_handler_start()
540 if (NULL != (conflict = zend_hash_find_ptr(&php_output_handler_conflicts, handler->name))) { in php_output_handler_start()
541 if (SUCCESS != conflict(ZSTR_VAL(handler->name), ZSTR_LEN(handler->name))) { in php_output_handler_start()
545 …if (NULL != (rconflicts = zend_hash_find_ptr(&php_output_handler_reverse_conflicts, handler->name)… in php_output_handler_start()
547 if (SUCCESS != conflict(ZSTR_VAL(handler->name), ZSTR_LEN(handler->name))) { in php_output_handler_start()
553 handler->level = zend_stack_push(&OG(handlers), &handler); in php_output_handler_start()
554 OG(active) = handler; in php_output_handler_start()
698 PHPAPI void php_output_handler_dtor(php_output_handler *handler) in php_output_handler_dtor() argument
700 if (handler->name) { in php_output_handler_dtor()
701 zend_string_release_ex(handler->name, 0); in php_output_handler_dtor()
703 if (handler->buffer.data) { in php_output_handler_dtor()
704 efree(handler->buffer.data); in php_output_handler_dtor()
706 if (handler->flags & PHP_OUTPUT_HANDLER_USER) { in php_output_handler_dtor()
707 zval_ptr_dtor(&handler->func.user->zoh); in php_output_handler_dtor()
708 efree(handler->func.user); in php_output_handler_dtor()
710 if (handler->dtor && handler->opaq) { in php_output_handler_dtor()
711 handler->dtor(handler->opaq); in php_output_handler_dtor()
713 memset(handler, 0, sizeof(*handler)); in php_output_handler_dtor()
858 php_output_handler *handler; in php_output_handler_init() local
860 handler = ecalloc(1, sizeof(php_output_handler)); in php_output_handler_init()
861 handler->name = zend_string_copy(name); in php_output_handler_init()
862 handler->size = chunk_size; in php_output_handler_init()
863 handler->flags = flags; in php_output_handler_init()
864 handler->buffer.size = PHP_OUTPUT_HANDLER_INITBUF_SIZE(chunk_size); in php_output_handler_init()
865 handler->buffer.data = emalloc(handler->buffer.size); in php_output_handler_init()
867 return handler; in php_output_handler_init()
873 static inline bool php_output_handler_append(php_output_handler *handler, const php_output_buffer *… in php_output_handler_append() argument
878 if ((handler->buffer.size - handler->buffer.used) <= buf->used) { in php_output_handler_append()
879 size_t grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); in php_output_handler_append()
880 …size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buf… in php_output_handler_append()
883 handler->buffer.data = safe_erealloc(handler->buffer.data, 1, handler->buffer.size, grow_max); in php_output_handler_append()
884 handler->buffer.size += grow_max; in php_output_handler_append()
886 memcpy(handler->buffer.data + handler->buffer.used, buf->data, buf->used); in php_output_handler_append()
887 handler->buffer.used += buf->used; in php_output_handler_append()
890 if (handler->size && (handler->buffer.used >= handler->size)) { in php_output_handler_append()
901 static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_ou… in php_output_handler_op() argument
917 handler, in php_output_handler_op()
918 handler->name, in php_output_handler_op()
919 handler->flags, in php_output_handler_op()
920 handler->buffer.used?handler->buffer.data:"", in php_output_handler_op()
921 handler->buffer.used, in php_output_handler_op()
922 handler->buffer.size, in php_output_handler_op()
928 if (handler->flags & PHP_OUTPUT_HANDLER_DISABLED) { in php_output_handler_op()
938 if (php_output_handler_append(handler, &context->in) && !context->op) { in php_output_handler_op()
943 if (!(handler->flags & PHP_OUTPUT_HANDLER_STARTED)) { in php_output_handler_op()
947 OG(running) = handler; in php_output_handler_op()
948 if (handler->flags & PHP_OUTPUT_HANDLER_USER) { in php_output_handler_op()
953 ZVAL_STRINGL(&ob_args[0], handler->buffer.data, handler->buffer.used); in php_output_handler_op()
958 handler->func.user->fci.param_count = 2; in php_output_handler_op()
959 handler->func.user->fci.params = ob_args; in php_output_handler_op()
960 handler->func.user->fci.retval = &retval; in php_output_handler_op()
963 …if (SUCCESS == zend_call_function(&handler->func.user->fci, &handler->func.user->fcc) && PHP_OUTPU… in php_output_handler_op()
987 …php_output_context_feed(context, handler->buffer.data, handler->buffer.size, handler->buffer.used,… in php_output_handler_op()
989 if (SUCCESS == handler->func.internal(&handler->opaq, context)) { in php_output_handler_op()
999 handler->flags |= PHP_OUTPUT_HANDLER_STARTED; in php_output_handler_op()
1006 handler->flags |= PHP_OUTPUT_HANDLER_DISABLED; in php_output_handler_op()
1012 context->out.data = handler->buffer.data; in php_output_handler_op()
1013 context->out.used = handler->buffer.used; in php_output_handler_op()
1015 handler->buffer.data = NULL; in php_output_handler_op()
1016 handler->buffer.used = 0; in php_output_handler_op()
1017 handler->buffer.size = 0; in php_output_handler_op()
1025 handler->buffer.used = 0; in php_output_handler_op()
1026 handler->flags |= PHP_OUTPUT_HANDLER_PROCESSED; in php_output_handler_op()
1097 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_op() local
1100 if ((was_disabled = (handler->flags & PHP_OUTPUT_HANDLER_DISABLED))) { in php_output_stack_apply_op()
1103 status = php_output_handler_op(handler, context); in php_output_stack_apply_op()
1116 if (handler->level) { in php_output_stack_apply_op()
1125 if (!handler->level) { in php_output_stack_apply_op()
1130 if (handler->level) { in php_output_stack_apply_op()
1143 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_clean() local
1146 handler->buffer.used = 0; in php_output_stack_apply_clean()
1147 php_output_handler_op(handler, context); in php_output_stack_apply_clean()
1157 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_list() local
1160 add_next_index_str(array, zend_string_copy(handler->name)); in php_output_stack_apply_list()
1169 php_output_handler *handler = *(php_output_handler **) h; in php_output_stack_apply_status() local
1172 add_next_index_zval(array, php_output_handler_status(handler, &arr)); in php_output_stack_apply_status()
1179 static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry) in php_output_handler_status() argument
1184 add_assoc_str(entry, "name", zend_string_copy(handler->name)); in php_output_handler_status()
1185 add_assoc_long(entry, "type", (zend_long) (handler->flags & 0xf)); in php_output_handler_status()
1186 add_assoc_long(entry, "flags", (zend_long) handler->flags); in php_output_handler_status()
1187 add_assoc_long(entry, "level", (zend_long) handler->level); in php_output_handler_status()
1188 add_assoc_long(entry, "chunk_size", (zend_long) handler->size); in php_output_handler_status()
1189 add_assoc_long(entry, "buffer_size", (zend_long) handler->buffer.size); in php_output_handler_status()
1190 add_assoc_long(entry, "buffer_used", (zend_long) handler->buffer.used); in php_output_handler_status()