diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 6ae6809b5ab9d..fe801d2c1b299 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -553,14 +553,16 @@ jobs:
           repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server"
           X=0
           for repository in $repositories; do
-            printf "Testing amp/%s\n" "$repository"
+            echo "::group::$repository"
             git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1
             cd "amphp-$repository"
             git rev-parse HEAD
             php /usr/bin/composer install --no-progress --ignore-platform-req=php+
             vendor/bin/phpunit || EXIT_CODE=$?
+            echo "::endgroup::"
             if [ ${EXIT_CODE:-0} -gt 128 ]; then
               X=1;
+              echo "Failed"
             fi
             cd ..
           done
@@ -584,14 +586,16 @@ jobs:
           repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream"
           X=0
           for repository in $repositories; do
-            printf "Testing reactphp/%s\n" "$repository"
+            echo "::group::$repository"
             git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1
             cd "reactphp-$repository"
             git rev-parse HEAD
             php /usr/bin/composer install --no-progress --ignore-platform-req=php+
             vendor/bin/phpunit || EXIT_CODE=$?
+            echo "::endgroup::"
             if [ $[EXIT_CODE:-0} -gt 128 ]; then
               X=1;
+              echo "Failed"
             fi
             cd ..
           done
@@ -622,9 +626,12 @@ jobs:
           export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
           X=0
           for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
+            echo "::group::$component"
             php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
+            echo "::endgroup::"
             if [ ${EXIT_CODE:-0} -gt 128 ]; then
               X=1;
+              echo "Failed"
             fi
           done
           exit $X
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index 9a028d736d1b2..8d2c0077efa40 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -33,7 +33,7 @@ static inline void *zend_ast_alloc(size_t size) {
 	return zend_arena_alloc(&CG(ast_arena), size);
 }
 
-static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size) {
+static inline void *zend_ast_realloc(const void *old, size_t old_size, size_t new_size) {
 	void *new = zend_ast_alloc(new_size);
 	memcpy(new, old, old_size);
 	return new;
@@ -43,7 +43,7 @@ static inline size_t zend_ast_list_size(uint32_t children) {
 	return sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
 }
 
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(znode *node) {
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(const znode *node) {
 	zend_ast_znode *ast;
 
 	ast = zend_ast_alloc(sizeof(zend_ast_znode));
@@ -66,7 +66,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_fcc(void) {
 	return (zend_ast *) ast;
 }
 
-static zend_always_inline zend_ast * zend_ast_create_zval_int(zval *zv, uint32_t attr, uint32_t lineno) {
+static zend_always_inline zend_ast * zend_ast_create_zval_int(const zval *zv, uint32_t attr, uint32_t lineno) {
 	zend_ast_zval *ast;
 
 	ast = zend_ast_alloc(sizeof(zend_ast_zval));
@@ -77,15 +77,15 @@ static zend_always_inline zend_ast * zend_ast_create_zval_int(zval *zv, uint32_t
 	return (zend_ast *) ast;
 }
 
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(zval *zv, uint32_t lineno) {
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(const zval *zv, uint32_t lineno) {
 	return zend_ast_create_zval_int(zv, 0, lineno);
 }
 
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(const zval *zv, zend_ast_attr attr) {
 	return zend_ast_create_zval_int(zv, attr, CG(zend_lineno));
 }
 
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(zval *zv) {
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(const zval *zv) {
 	return zend_ast_create_zval_int(zv, 0, CG(zend_lineno));
 }
 
@@ -508,7 +508,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_list_add(zend_ast *ast, zend_ast *op)
 	return (zend_ast *) list;
 }
 
-static zend_result zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
+static zend_result zend_ast_add_array_element(const zval *result, zval *offset, zval *expr)
 {
 	if (Z_TYPE_P(offset) == IS_UNDEF) {
 		if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
@@ -528,9 +528,9 @@ static zend_result zend_ast_add_array_element(zval *result, zval *offset, zval *
 	return SUCCESS;
 }
 
-static zend_result zend_ast_add_unpacked_element(zval *result, zval *expr) {
+static zend_result zend_ast_add_unpacked_element(const zval *result, const zval *expr) {
 	if (EXPECTED(Z_TYPE_P(expr) == IS_ARRAY)) {
-		HashTable *ht = Z_ARRVAL_P(expr);
+		const HashTable *ht = Z_ARRVAL_P(expr);
 		zval *val;
 		zend_string *key;
 
@@ -1243,7 +1243,7 @@ static size_t ZEND_FASTCALL zend_ast_tree_size(zend_ast *ast)
 		size = sizeof(zend_ast_fcc);
 	} else if (zend_ast_is_list(ast)) {
 		uint32_t i;
-		zend_ast_list *list = zend_ast_get_list(ast);
+		const zend_ast_list *list = zend_ast_get_list(ast);
 
 		size = zend_ast_list_size(list->children);
 		for (i = 0; i < list->children; i++) {
@@ -1284,7 +1284,7 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
 		Z_LINENO(new->val) = zend_ast_get_lineno(ast);
 		buf = (void*)((char*)buf + sizeof(zend_ast_zval));
 	} else if (zend_ast_is_list(ast)) {
-		zend_ast_list *list = zend_ast_get_list(ast);
+		const zend_ast_list *list = zend_ast_get_list(ast);
 		zend_ast_list *new = (zend_ast_list*)buf;
 		uint32_t i;
 		new->kind = list->kind;
@@ -1301,7 +1301,7 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
 			}
 		}
 	} else if (ast->kind == ZEND_AST_OP_ARRAY) {
-		zend_ast_op_array *old = zend_ast_get_op_array(ast);
+		const zend_ast_op_array *old = zend_ast_get_op_array(ast);
 		zend_ast_op_array *new = (zend_ast_op_array*)buf;
 		new->kind = old->kind;
 		new->attr = old->attr;
@@ -1310,7 +1310,7 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
 		function_add_ref((zend_function *)new->op_array);
 		buf = (void*)((char*)buf + sizeof(zend_ast_op_array));
 	} else if (ast->kind == ZEND_AST_CALLABLE_CONVERT) {
-		zend_ast_fcc *old = (zend_ast_fcc*)ast;
+		const zend_ast_fcc *old = (zend_ast_fcc*)ast;
 		zend_ast_fcc *new = (zend_ast_fcc*)buf;
 		new->kind = old->kind;
 		new->attr = old->attr;
@@ -1371,7 +1371,7 @@ ZEND_API void ZEND_FASTCALL zend_ast_destroy(zend_ast *ast)
 	} else if (EXPECTED(ast->kind == ZEND_AST_ZVAL)) {
 		zval_ptr_dtor_nogc(zend_ast_get_zval(ast));
 	} else if (EXPECTED(zend_ast_is_list(ast))) {
-		zend_ast_list *list = zend_ast_get_list(ast);
+		const zend_ast_list *list = zend_ast_get_list(ast);
 		if (list->children) {
 			uint32_t i;
 
@@ -1386,7 +1386,7 @@ ZEND_API void ZEND_FASTCALL zend_ast_destroy(zend_ast *ast)
 	} else if (EXPECTED(ast->kind == ZEND_AST_OP_ARRAY)) {
 		destroy_op_array(zend_ast_get_op_array(ast)->op_array);
 	} else if (EXPECTED(zend_ast_is_decl(ast))) {
-		zend_ast_decl *decl = (zend_ast_decl *) ast;
+		const zend_ast_decl *decl = (const zend_ast_decl *) ast;
 
 		if (decl->name) {
 		    zend_string_release_ex(decl->name, 0);
@@ -1465,7 +1465,7 @@ ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *contex
 
 static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int priority, int indent);
 
-static ZEND_COLD void zend_ast_export_str(smart_str *str, zend_string *s)
+static ZEND_COLD void zend_ast_export_str(smart_str *str, const zend_string *s)
 {
 	size_t i;
 
@@ -1480,7 +1480,7 @@ static ZEND_COLD void zend_ast_export_str(smart_str *str, zend_string *s)
 	}
 }
 
-static ZEND_COLD void zend_ast_export_qstr(smart_str *str, char quote, zend_string *s)
+static ZEND_COLD void zend_ast_export_qstr(smart_str *str, char quote, const zend_string *s)
 {
 	size_t i;
 
@@ -1536,7 +1536,7 @@ static ZEND_COLD void zend_ast_export_indent(smart_str *str, int indent)
 static ZEND_COLD void zend_ast_export_name(smart_str *str, zend_ast *ast, int priority, int indent)
 {
 	if (ast->kind == ZEND_AST_ZVAL) {
-		zval *zv = zend_ast_get_zval(ast);
+		const zval *zv = zend_ast_get_zval(ast);
 
 		if (Z_TYPE_P(zv) == IS_STRING) {
 			smart_str_append(str, Z_STR_P(zv));
@@ -1549,7 +1549,7 @@ static ZEND_COLD void zend_ast_export_name(smart_str *str, zend_ast *ast, int pr
 static ZEND_COLD void zend_ast_export_ns_name(smart_str *str, zend_ast *ast, int priority, int indent)
 {
 	if (ast->kind == ZEND_AST_ZVAL) {
-		zval *zv = zend_ast_get_zval(ast);
+		const zval *zv = zend_ast_get_zval(ast);
 
 		if (Z_TYPE_P(zv) == IS_STRING) {
 		    if (ast->attr == ZEND_NAME_FQ) {
@@ -1628,7 +1628,7 @@ static ZEND_COLD void zend_ast_export_var(smart_str *str, zend_ast *ast, int pri
 
 /* Use zend_ast_export_list() unless fewer than `list->children` children should
  * be exported. */
-static ZEND_COLD void zend_ast_export_list_ex(smart_str *str, zend_ast_list *list, bool separator, int priority, int indent, int children)
+static ZEND_COLD void zend_ast_export_list_ex(smart_str *str, const zend_ast_list *list, bool separator, int priority, int indent, uint32_t children)
 {
 	ZEND_ASSERT(children <= list->children);
 	uint32_t i = 0;
@@ -1642,12 +1642,12 @@ static ZEND_COLD void zend_ast_export_list_ex(smart_str *str, zend_ast_list *lis
 	}
 }
 
-static ZEND_COLD void zend_ast_export_list(smart_str *str, zend_ast_list *list, bool separator, int priority, int indent)
+static ZEND_COLD void zend_ast_export_list(smart_str *str, const zend_ast_list *list, bool separator, int priority, int indent)
 {
 	zend_ast_export_list_ex(str, list, separator, priority, indent, list->children);
 }
 
-static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, zend_ast_list *list, int indent)
+static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, const zend_ast_list *list, int indent)
 {
 	uint32_t i = 0;
 	zend_ast *ast;
@@ -1655,7 +1655,7 @@ static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, ze
 	while (i < list->children) {
 		ast = list->child[i];
 		if (ast->kind == ZEND_AST_ZVAL) {
-			zval *zv = zend_ast_get_zval(ast);
+			const zval *zv = zend_ast_get_zval(ast);
 
 			ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
 			zend_ast_export_qstr(str, quote, Z_STR_P(zv));
@@ -1676,7 +1676,7 @@ static ZEND_COLD void zend_ast_export_encaps_list(smart_str *str, char quote, ze
 	}
 }
 
-static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, zend_ast_list *list, int indent, const char *separator)
+static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, const zend_ast_list *list, int indent, const char *separator)
 {
 	uint32_t i = 0;
 
@@ -1692,7 +1692,7 @@ static ZEND_COLD void zend_ast_export_name_list_ex(smart_str *str, zend_ast_list
 #define zend_ast_export_name_list(s, l, i) zend_ast_export_name_list_ex(s, l, i, ", ")
 #define zend_ast_export_catch_name_list(s, l, i) zend_ast_export_name_list_ex(s, l, i, "|")
 
-static ZEND_COLD void zend_ast_export_var_list(smart_str *str, zend_ast_list *list, int indent)
+static ZEND_COLD void zend_ast_export_var_list(smart_str *str, const zend_ast_list *list, int indent)
 {
 	uint32_t i = 0;
 
@@ -1717,7 +1717,7 @@ static ZEND_COLD void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int in
 
 	if (ast->kind == ZEND_AST_STMT_LIST ||
 	    ast->kind == ZEND_AST_TRAIT_ADAPTATIONS) {
-		zend_ast_list *list = (zend_ast_list*)ast;
+		const zend_ast_list *list = (const zend_ast_list*)ast;
 		uint32_t i = 0;
 
 		while (i < list->children) {
@@ -1744,8 +1744,8 @@ static ZEND_COLD void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int in
 			case ZEND_AST_DECLARE:
 				break;
 			case ZEND_AST_PROP_GROUP: {
-				zend_ast *first_prop = zend_ast_get_list(ast->child[1])->child[0];
-				zend_ast *hook_list = first_prop->child[3];
+				const zend_ast *first_prop = zend_ast_get_list(ast->child[1])->child[0];
+				const zend_ast *hook_list = first_prop->child[3];
 				if (hook_list == NULL) {
 					smart_str_appendc(str, ';');
 				}
@@ -1759,7 +1759,7 @@ static ZEND_COLD void zend_ast_export_stmt(smart_str *str, zend_ast *ast, int in
 	}
 }
 
-static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, zend_ast_list *list, int indent)
+static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, const zend_ast_list *list, int indent)
 {
 	uint32_t i;
 	zend_ast *ast;
@@ -1783,7 +1783,7 @@ static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, zend_ast_list *lis
 			zend_ast_export_indent(str, indent);
 			smart_str_appends(str, "} else ");
 			if (ast->child[1] && ast->child[1]->kind == ZEND_AST_IF) {
-				list = (zend_ast_list*)ast->child[1];
+				list = (const zend_ast_list*)ast->child[1];
 				goto tail_call;
 			} else {
 				smart_str_appends(str, "{\n");
@@ -1796,7 +1796,7 @@ static ZEND_COLD void zend_ast_export_if_stmt(smart_str *str, zend_ast_list *lis
 	smart_str_appendc(str, '}');
 }
 
-static ZEND_COLD void zend_ast_export_zval(smart_str *str, zval *zv, int priority, int indent)
+static ZEND_COLD void zend_ast_export_zval(smart_str *str, const zval *zv, int priority, int indent)
 {
 	ZVAL_DEREF(zv);
 	switch (Z_TYPE_P(zv)) {
@@ -1853,7 +1853,7 @@ static ZEND_COLD void zend_ast_export_zval(smart_str *str, zval *zv, int priorit
 	}
 }
 
-static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_decl *decl, int indent) {
+static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, const zend_ast_decl *decl, int indent) {
 	if (decl->child[0]) {
 		smart_str_appends(str, " extends ");
 		zend_ast_export_ns_name(str, decl->child[0], 0, indent);
@@ -1869,9 +1869,9 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_d
 }
 
 static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *ast, int indent) {
-	zend_ast_list *list = zend_ast_get_list(ast);
+	const zend_ast_list *list = zend_ast_get_list(ast);
 	for (uint32_t i = 0; i < list->children; i++) {
-		zend_ast *attr = list->child[i];
+		const zend_ast *attr = list->child[i];
 
 		if (i) {
 			smart_str_appends(str, ", ");
@@ -1887,7 +1887,7 @@ static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *
 }
 
 static ZEND_COLD void zend_ast_export_attributes(smart_str *str, zend_ast *ast, int indent, bool newlines) {
-	zend_ast_list *list = zend_ast_get_list(ast);
+	const zend_ast_list *list = zend_ast_get_list(ast);
 	uint32_t i;
 
 	for (i = 0; i < list->children; i++) {
@@ -1926,7 +1926,7 @@ static ZEND_COLD void zend_ast_export_visibility(smart_str *str, uint32_t flags,
 
 static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int indent) {
 	if (ast->kind == ZEND_AST_TYPE_UNION) {
-		zend_ast_list *list = zend_ast_get_list(ast);
+		const zend_ast_list *list = zend_ast_get_list(ast);
 		for (uint32_t i = 0; i < list->children; i++) {
 			if (i != 0) {
 				smart_str_appendc(str, '|');
@@ -1936,7 +1936,7 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
 		return;
 	}
 	if (ast->kind == ZEND_AST_TYPE_INTERSECTION) {
-		zend_ast_list *list = zend_ast_get_list(ast);
+		const zend_ast_list *list = zend_ast_get_list(ast);
 		for (uint32_t i = 0; i < list->children; i++) {
 			if (i != 0) {
 				smart_str_appendc(str, '&');
@@ -1951,7 +1951,7 @@ static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int in
 	zend_ast_export_ns_name(str, ast, 0, indent);
 }
 
-static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, zend_ast_list *hook_list, int indent)
+static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, const zend_ast_list *hook_list, int indent)
 {
 	smart_str_appends(str, " {");
 	smart_str_appendc(str, '\n');
@@ -1959,7 +1959,7 @@ static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, zend_ast_list *h
 	zend_ast_export_indent(str, indent);
 
 	for (uint32_t i = 0; i < hook_list->children; i++) {
-		zend_ast_decl *hook = (zend_ast_decl *)hook_list->child[i];
+		const zend_ast_decl *hook = (const zend_ast_decl *)hook_list->child[i];
 		zend_ast_export_visibility(str, hook->flags, ZEND_MODIFIER_TARGET_PROPERTY);
 		if (hook->flags & ZEND_ACC_FINAL) {
 			smart_str_appends(str, "final ");
@@ -2033,7 +2033,7 @@ static ZEND_COLD void zend_ast_export_hook_list(smart_str *str, zend_ast_list *h
 
 static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int priority, int indent)
 {
-	zend_ast_decl *decl;
+	const zend_ast_decl *decl;
 	int p, pl, pr;
 	const char *op;
 
@@ -2069,7 +2069,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 		case ZEND_AST_CLOSURE:
 		case ZEND_AST_ARROW_FUNC:
 		case ZEND_AST_METHOD:
-			decl = (zend_ast_decl *) ast;
+			decl = (const zend_ast_decl *) ast;
 			if (decl->child[4]) {
 				bool newlines = !(ast->kind == ZEND_AST_CLOSURE || ast->kind == ZEND_AST_ARROW_FUNC);
 				zend_ast_export_attributes(str, decl->child[4], indent, newlines);
@@ -2128,7 +2128,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 			}
 			break;
 		case ZEND_AST_CLASS:
-			decl = (zend_ast_decl *) ast;
+			decl = (const zend_ast_decl *) ast;
 			if (decl->child[3]) {
 				zend_ast_export_attributes(str, decl->child[3], indent, 1);
 			}
@@ -2164,16 +2164,16 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 		case ZEND_AST_EXPR_LIST:
 		case ZEND_AST_PARAM_LIST:
 simple_list:
-			zend_ast_export_list(str, (zend_ast_list*)ast, 1, 20, indent);
+			zend_ast_export_list(str, zend_ast_get_list(ast), 1, 20, indent);
 			break;
 		case ZEND_AST_ARRAY:
 			smart_str_appendc(str, '[');
-			zend_ast_export_list(str, (zend_ast_list*)ast, 1, 20, indent);
+			zend_ast_export_list(str, zend_ast_get_list(ast), 1, 20, indent);
 			smart_str_appendc(str, ']');
 			break;
 		case ZEND_AST_ENCAPS_LIST:
 			smart_str_appendc(str, '"');
-			zend_ast_export_encaps_list(str, '"', (zend_ast_list*)ast, indent);
+			zend_ast_export_encaps_list(str, '"', zend_ast_get_list(ast), indent);
 			smart_str_appendc(str, '"');
 			break;
 		case ZEND_AST_STMT_LIST:
@@ -2181,16 +2181,16 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 			zend_ast_export_stmt(str, ast, indent);
 			break;
 		case ZEND_AST_IF:
-			zend_ast_export_if_stmt(str, (zend_ast_list*)ast, indent);
+			zend_ast_export_if_stmt(str, zend_ast_get_list(ast), indent);
 			break;
 		case ZEND_AST_SWITCH_LIST:
 		case ZEND_AST_CATCH_LIST:
 		case ZEND_AST_MATCH_ARM_LIST:
-			zend_ast_export_list(str, (zend_ast_list*)ast, 0, 0, indent);
+			zend_ast_export_list(str, zend_ast_get_list(ast), 0, 0, indent);
 			break;
 		case ZEND_AST_CLOSURE_USES:
 			smart_str_appends(str, " use(");
-			zend_ast_export_var_list(str, (zend_ast_list*)ast, indent);
+			zend_ast_export_var_list(str, zend_ast_get_list(ast), indent);
 			smart_str_appendc(str, ')');
 			break;
 		case ZEND_AST_PROP_GROUP: {
@@ -2255,7 +2255,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 
 			goto simple_list;
 		case ZEND_AST_NAME_LIST:
-			zend_ast_export_name_list(str, (zend_ast_list*)ast, indent);
+			zend_ast_export_name_list(str, zend_ast_get_list(ast), indent);
 			break;
 		case ZEND_AST_USE:
 			smart_str_appends(str, "use ");
@@ -2329,7 +2329,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 		case ZEND_AST_SHELL_EXEC:
 			smart_str_appendc(str, '`');
 			if (ast->child[0]->kind == ZEND_AST_ENCAPS_LIST) {
-				zend_ast_export_encaps_list(str, '`', (zend_ast_list*)ast->child[0], indent);
+				zend_ast_export_encaps_list(str, '`', zend_ast_get_list(ast->child[0]), indent);
 			} else {
 				zval *zv;
 				ZEND_ASSERT(ast->child[0]->kind == ZEND_AST_ZVAL);
@@ -2523,7 +2523,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 		case ZEND_AST_NEW:
 			smart_str_appends(str, "new ");
 			if (ast->child[0]->kind == ZEND_AST_CLASS) {
-				zend_ast_decl *decl = (zend_ast_decl *) ast->child[0];
+				const zend_ast_decl *decl = (const zend_ast_decl *) ast->child[0];
 				if (decl->child[3]) {
 					zend_ast_export_attributes(str, decl->child[3], indent, 0);
 				}
@@ -2626,7 +2626,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 		case ZEND_AST_MATCH_ARM:
 			zend_ast_export_indent(str, indent);
 			if (ast->child[0]) {
-				zend_ast_export_list(str, (zend_ast_list*)ast->child[0], 1, 0, indent);
+				zend_ast_export_list(str, zend_ast_get_list(ast->child[0]), 1, 0, indent);
 				smart_str_appends(str, " => ");
 			} else {
 				smart_str_appends(str, "default => ");
@@ -2637,7 +2637,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
 		case ZEND_AST_DECLARE:
 			smart_str_appends(str, "declare(");
 			ZEND_ASSERT(ast->child[0]->kind == ZEND_AST_CONST_DECL);
-			zend_ast_export_list(str, (zend_ast_list*)ast->child[0], 1, 0, indent);
+			zend_ast_export_list(str, zend_ast_get_list(ast->child[0]), 1, 0, indent);
 			smart_str_appendc(str, ')');
 			if (ast->child[1]) {
 				smart_str_appends(str, " {\n");
diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h
index 08400cff5dd8e..2e561f225917a 100644
--- a/Zend/zend_ast.h
+++ b/Zend/zend_ast.h
@@ -239,9 +239,9 @@ typedef struct _zend_ast_fcc {
 typedef void (*zend_ast_process_t)(zend_ast *ast);
 extern ZEND_API zend_ast_process_t zend_ast_process;
 
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(zval *zv, uint32_t lineno);
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr);
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(zval *zv);
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_with_lineno(const zval *zv, uint32_t lineno);
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_ex(const zval *zv, zend_ast_attr attr);
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval(const zval *zv);
 ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_from_str(zend_string *str);
 ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_zval_from_long(zend_long lval);
 
@@ -348,15 +348,15 @@ static zend_always_inline size_t zend_ast_size(uint32_t children) {
 	return XtOffsetOf(zend_ast, child) + (sizeof(zend_ast *) * children);
 }
 
-static zend_always_inline bool zend_ast_is_special(zend_ast *ast) {
+static zend_always_inline bool zend_ast_is_special(const zend_ast *ast) {
 	return (ast->kind >> ZEND_AST_SPECIAL_SHIFT) & 1;
 }
 
-static zend_always_inline bool zend_ast_is_decl(zend_ast *ast) {
+static zend_always_inline bool zend_ast_is_decl(const zend_ast *ast) {
 	return zend_ast_is_special(ast) && ast->kind >= ZEND_AST_FUNC_DECL;
 }
 
-static zend_always_inline bool zend_ast_is_list(zend_ast *ast) {
+static zend_always_inline bool zend_ast_is_list(const zend_ast *ast) {
 	return (ast->kind >> ZEND_AST_IS_LIST_SHIFT) & 1;
 }
 static zend_always_inline zend_ast_list *zend_ast_get_list(zend_ast *ast) {
@@ -369,7 +369,7 @@ static zend_always_inline zval *zend_ast_get_zval(zend_ast *ast) {
 	return &((zend_ast_zval *) ast)->val;
 }
 static zend_always_inline zend_string *zend_ast_get_str(zend_ast *ast) {
-	zval *zv = zend_ast_get_zval(ast);
+	const zval *zv = zend_ast_get_zval(ast);
 	ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
 	return Z_STR_P(zv);
 }
@@ -385,7 +385,7 @@ static zend_always_inline zend_string *zend_ast_get_constant_name(zend_ast *ast)
 	return Z_STR(((zend_ast_zval *) ast)->val);
 }
 
-static zend_always_inline uint32_t zend_ast_get_num_children(zend_ast *ast) {
+static zend_always_inline uint32_t zend_ast_get_num_children(const zend_ast *ast) {
 	ZEND_ASSERT(!zend_ast_is_list(ast));
 	ZEND_ASSERT(!zend_ast_is_special(ast));
 
@@ -393,10 +393,10 @@ static zend_always_inline uint32_t zend_ast_get_num_children(zend_ast *ast) {
 }
 static zend_always_inline uint32_t zend_ast_get_lineno(zend_ast *ast) {
 	if (ast->kind == ZEND_AST_ZVAL) {
-		zval *zv = zend_ast_get_zval(ast);
+		const zval *zv = zend_ast_get_zval(ast);
 		return Z_LINENO_P(zv);
 	} else if (ast->kind == ZEND_AST_CONSTANT) {
-		zval *zv = &((zend_ast_zval *) ast)->val;
+		const zval *zv = &((const zend_ast_zval *) ast)->val;
 		return Z_LINENO_P(zv);
 	} else {
 		return ast->lineno;
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 39a159236f035..a083babcd8109 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -97,7 +97,7 @@ typedef struct _zend_ast_znode {
 	znode node;
 } zend_ast_znode;
 
-ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(znode *node);
+ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(const znode *node);
 
 static zend_always_inline znode *zend_ast_get_znode(zend_ast *ast) {
 	return &((zend_ast_znode *) ast)->node;
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index 46c34b5efe6af..8796e01f6381f 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -17,6 +17,7 @@
 #endif
 
 #include "../intl_cppshims.h"
+#include <memory>
 
 #include <unicode/locid.h>
 #include <unicode/calendar.h>
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp
index da306c5896be2..a5113ce4cf9e1 100644
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -13,6 +13,7 @@
 */
 
 #include "../intl_cppshims.h"
+#include <memory>
 
 #include <unicode/calendar.h>
 #include <unicode/gregocal.h>
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index 0cc6e1378729f..0737d99423110 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -18,6 +18,7 @@
 #endif
 
 #include "../intl_cppshims.h"
+#include <memory>
 
 #include <unicode/timezone.h>
 #include <unicode/calendar.h>
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c
index c147b8eb23d73..a73277915405d 100644
--- a/ext/json/json_encoder.c
+++ b/ext/json/json_encoder.c
@@ -41,18 +41,6 @@ static zend_always_inline bool php_json_check_stack_limit(void)
 #endif
 }
 
-static int php_json_determine_array_type(zval *val) /* {{{ */
-{
-	zend_array *myht = Z_ARRVAL_P(val);
-
-	if (myht) {
-		return zend_array_is_list(myht) ? PHP_JSON_OUTPUT_ARRAY : PHP_JSON_OUTPUT_OBJECT;
-	}
-
-	return PHP_JSON_OUTPUT_ARRAY;
-}
-/* }}} */
-
 /* {{{ Pretty printing support functions */
 
 static inline void php_json_pretty_print_char(smart_str *buf, int options, char c) /* {{{ */
@@ -63,12 +51,10 @@ static inline void php_json_pretty_print_char(smart_str *buf, int options, char
 }
 /* }}} */
 
-static inline void php_json_pretty_print_indent(smart_str *buf, int options, php_json_encoder *encoder) /* {{{ */
+static inline void php_json_pretty_print_indent(smart_str *buf, int options, const php_json_encoder *encoder) /* {{{ */
 {
-	int i;
-
 	if (options & PHP_JSON_PRETTY_PRINT) {
-		for (i = 0; i < encoder->depth; ++i) {
+		for (int i = 0; i < encoder->depth; ++i) {
 			smart_str_appendl(buf, "    ", 4);
 		}
 	}
@@ -122,7 +108,8 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)
 
 static zend_result php_json_encode_array(smart_str *buf, zval *val, int options, php_json_encoder *encoder) /* {{{ */
 {
-	int r, need_comma = 0;
+	bool encode_as_object = options & PHP_JSON_FORCE_OBJECT;
+	bool need_comma = false;
 	HashTable *myht, *prop_ht;
 	zend_refcounted *recursion_rc;
 
@@ -138,7 +125,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 		myht = Z_ARRVAL_P(val);
 		recursion_rc = (zend_refcounted *)myht;
 		prop_ht = NULL;
-		r = (options & PHP_JSON_FORCE_OBJECT) ? PHP_JSON_OUTPUT_OBJECT : php_json_determine_array_type(val);
+		encode_as_object = encode_as_object || !zend_array_is_list(myht);
 	} else if (Z_OBJ_P(val)->properties == NULL
 	 && Z_OBJ_HT_P(val)->get_properties_for == NULL
 	 && Z_OBJ_HT_P(val)->get_properties == zend_std_get_properties
@@ -146,9 +133,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 	 && !zend_object_is_lazy(Z_OBJ_P(val))) {
 		/* Optimized version without rebuilding properties HashTable */
 		zend_object *obj = Z_OBJ_P(val);
-		zend_class_entry *ce = obj->ce;
-		zend_property_info *prop_info;
-		zval *prop;
+		const zend_class_entry *ce = obj->ce;
 
 		if (GC_IS_RECURSIVE(obj)) {
 			encoder->error_code = PHP_JSON_ERROR_RECURSION;
@@ -163,7 +148,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 		++encoder->depth;
 
 		for (int i = 0; i < ce->default_properties_count; i++) {
-			prop_info = ce->properties_info_table[i];
+			zend_property_info *prop_info = ce->properties_info_table[i];
 			if (!prop_info) {
 				continue;
 			}
@@ -171,7 +156,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 				/* Skip protected and private members. */
 				continue;
 			}
-			prop = OBJ_PROP(obj, prop_info->offset);
+			zval *prop = OBJ_PROP(obj, prop_info->offset);
 			if (Z_TYPE_P(prop) == IS_UNDEF) {
 				continue;
 			}
@@ -228,7 +213,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 			 * referenced from a different place in the object graph. */
 			recursion_rc = (zend_refcounted *)obj;
 		}
-		r = PHP_JSON_OUTPUT_OBJECT;
+		encode_as_object = true;
 	}
 
 	if (recursion_rc && GC_IS_RECURSIVE(recursion_rc)) {
@@ -240,7 +225,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 
 	PHP_JSON_HASH_PROTECT_RECURSION(recursion_rc);
 
-	if (r == PHP_JSON_OUTPUT_ARRAY) {
+	if (!encode_as_object) {
 		smart_str_appendc(buf, '[');
 	} else {
 		smart_str_appendc(buf, '{');
@@ -259,7 +244,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 			zval tmp;
 			ZVAL_UNDEF(&tmp);
 
-			if (r == PHP_JSON_OUTPUT_ARRAY) {
+			if (!encode_as_object) {
 				ZEND_ASSERT(Z_TYPE_P(data) != IS_PTR);
 
 				if (need_comma) {
@@ -270,7 +255,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 
 				php_json_pretty_print_char(buf, options, '\n');
 				php_json_pretty_print_indent(buf, options, encoder);
-			} else if (r == PHP_JSON_OUTPUT_OBJECT) {
+			} else {
 				if (key) {
 					if (ZSTR_VAL(key)[0] == '\0' && ZSTR_LEN(key) > 0 && Z_TYPE_P(val) == IS_OBJECT) {
 						/* Skip protected and private members. */
@@ -354,7 +339,7 @@ static zend_result php_json_encode_array(smart_str *buf, zval *val, int options,
 		php_json_pretty_print_indent(buf, options, encoder);
 	}
 
-	if (r == PHP_JSON_OUTPUT_ARRAY) {
+	if (!encode_as_object) {
 		smart_str_appendc(buf, ']');
 	} else {
 		smart_str_appendc(buf, '}');
@@ -369,7 +354,6 @@ zend_result php_json_escape_string(
 		smart_str *buf, const char *s, size_t len,
 		int options, php_json_encoder *encoder) /* {{{ */
 {
-	unsigned int us;
 	size_t pos, checkpoint;
 	char *dst;
 
@@ -407,7 +391,7 @@ zend_result php_json_escape_string(
 			0xffffffff, 0x500080c4, 0x10000000, 0x00000000,
 			0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
 
-		us = (unsigned char)s[pos];
+		unsigned int us = (unsigned char)s[pos];
 		if (EXPECTED(!ZEND_BIT_TEST(charmap, us))) {
 			pos++;
 			len--;
@@ -626,7 +610,7 @@ static zend_result php_json_encode_serializable_object(smart_str *buf, zend_obje
 
 static zend_result php_json_encode_serializable_enum(smart_str *buf, zval *val, int options, php_json_encoder *encoder)
 {
-	zend_class_entry *ce = Z_OBJCE_P(val);
+	const zend_class_entry *ce = Z_OBJCE_P(val);
 	if (ce->enum_backing_type == IS_UNDEF) {
 		encoder->error_code = PHP_JSON_ERROR_NON_BACKED_ENUM;
 		smart_str_appendc(buf, '0');
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index 00c87eca53c9e..b79c7c836f7a3 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -79,10 +79,6 @@ typedef enum {
 #define PHP_JSON_INVALID_UTF8_SUBSTITUTE    (1<<21)
 #define PHP_JSON_THROW_ON_ERROR             (1<<22)
 
-/* Internal flags */
-#define PHP_JSON_OUTPUT_ARRAY	0
-#define PHP_JSON_OUTPUT_OBJECT	1
-
 /* default depth */
 #define PHP_JSON_PARSER_DEFAULT_DEPTH 512
 
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index 3485bd8df0024..f9320fd86ea83 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -526,10 +526,10 @@ static int pgsql_stmt_fetch(pdo_stmt_t *stmt,
 		ExecStatusType status;
 
 		switch (ori) {
-			case PDO_FETCH_ORI_NEXT: 	spprintf(&ori_str, 0, "NEXT"); break;
-			case PDO_FETCH_ORI_PRIOR:	spprintf(&ori_str, 0, "BACKWARD"); break;
-			case PDO_FETCH_ORI_FIRST:	spprintf(&ori_str, 0, "FIRST"); break;
-			case PDO_FETCH_ORI_LAST:	spprintf(&ori_str, 0, "LAST"); break;
+			case PDO_FETCH_ORI_NEXT: 	ori_str = "NEXT"; break;
+			case PDO_FETCH_ORI_PRIOR:	ori_str = "BACKWARD"; break;
+			case PDO_FETCH_ORI_FIRST:	ori_str = "FIRST"; break;
+			case PDO_FETCH_ORI_LAST:	ori_str = "LAST"; break;
 			case PDO_FETCH_ORI_ABS:		spprintf(&ori_str, 0, "ABSOLUTE " ZEND_LONG_FMT, offset); break;
 			case PDO_FETCH_ORI_REL:		spprintf(&ori_str, 0, "RELATIVE " ZEND_LONG_FMT, offset); break;
 			default:
@@ -542,7 +542,9 @@ static int pgsql_stmt_fetch(pdo_stmt_t *stmt,
 		}
 
 		spprintf(&q, 0, "FETCH %s FROM %s", ori_str, S->cursor_name);
-		efree(ori_str);
+		if (ori == PDO_FETCH_ORI_ABS || ori == PDO_FETCH_ORI_REL) {
+			efree(ori_str);
+		}
 		S->result = PQexec(S->H->server, q);
 		efree(q);
 		status = PQresultStatus(S->result);
diff --git a/ext/posix/tests/posix_kill_pidoverflow.phpt b/ext/posix/tests/posix_kill_pidoverflow.phpt
index d86b8c4da3bb2..0e8b8c7b7df12 100644
--- a/ext/posix/tests/posix_kill_pidoverflow.phpt
+++ b/ext/posix/tests/posix_kill_pidoverflow.phpt
@@ -2,6 +2,7 @@
 posix_kill() with large pid
 --EXTENSIONS--
 posix
+pcntl
 --SKIPIF--
 <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
 --FILE--
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 9fefe153622fc..85f5974be7e57 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -638,13 +638,9 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
 
 	/* protocol version we are speaking */
 	if (context && (tmpzval = php_stream_context_get_option(context, "http", "protocol_version")) != NULL) {
-		char *protocol_version;
-		spprintf(&protocol_version, 0, "%.1F", zval_get_double(tmpzval));
-
 		smart_str_appends(&req_buf, " HTTP/");
-		smart_str_appends(&req_buf, protocol_version);
+		smart_str_append_printf(&req_buf, "%.1F", zval_get_double(tmpzval));
 		smart_str_appends(&req_buf, "\r\n");
-		efree(protocol_version);
 	} else {
 		smart_str_appends(&req_buf, " HTTP/1.1\r\n");
 	}
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index d906aa2315e4d..456a6f51735e0 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.c
@@ -383,10 +383,12 @@ PHP_FUNCTION(msg_send)
 				message_len = spprintf(&p, 0, ZEND_LONG_FMT, Z_LVAL_P(message));
 				break;
 			case IS_FALSE:
-				message_len = spprintf(&p, 0, "0");
+				p = "0";
+				message_len = 1;
 				break;
 			case IS_TRUE:
-				message_len = spprintf(&p, 0, "1");
+				p = "1";
+				message_len = 1;
 				break;
 			case IS_DOUBLE:
 				message_len = spprintf(&p, 0, "%F", Z_DVAL_P(message));
@@ -400,7 +402,7 @@ PHP_FUNCTION(msg_send)
 		messagebuffer = safe_emalloc(message_len, 1, sizeof(struct php_msgbuf));
 		memcpy(messagebuffer->mtext, p, message_len + 1);
 
-		if (Z_TYPE_P(message) != IS_STRING) {
+		if (Z_TYPE_P(message) == IS_LONG || Z_TYPE_P(message) == IS_DOUBLE) {
 			efree(p);
 		}
 	}
diff --git a/main/main.c b/main/main.c
index 1cff1cee27a40..be03d9a70fda6 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1049,7 +1049,7 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
 	const char *space = "";
 	const char *class_name = "";
 	const char *function;
-	int origin_len;
+	size_t origin_len;
 	char *origin;
 	zend_string *message;
 	int is_function = 0;
@@ -1116,9 +1116,10 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
 
 	/* if we still have memory then format the origin */
 	if (is_function) {
-		origin_len = (int)spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params);
+		origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params);
 	} else {
-		origin_len = (int)spprintf(&origin, 0, "%s", function);
+		origin_len = strlen(function);
+		origin = estrndup(function, origin_len);
 	}
 
 	if (PG(html_errors)) {
@@ -1135,14 +1136,14 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
 
 	/* no docref given but function is known (the default) */
 	if (!docref && is_function) {
-		int doclen;
+		size_t doclen;
 		while (*function == '_') {
 			function++;
 		}
 		if (space[0] == '\0') {
-			doclen = (int)spprintf(&docref_buf, 0, "function.%s", function);
+			doclen = spprintf(&docref_buf, 0, "function.%s", function);
 		} else {
-			doclen = (int)spprintf(&docref_buf, 0, "%s.%s", class_name, function);
+			doclen = spprintf(&docref_buf, 0, "%s.%s", class_name, function);
 		}
 		while((p = strchr(docref_buf, '_')) != NULL) {
 			*p = '-';
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index e18cfebda08f5..7743d28f448dd 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -1383,14 +1383,14 @@ static void fpm_conf_cleanup(int which, void *arg) /* {{{ */
 
 static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */
 {
-	char *filename;
 	int *error = (int *)arg;
 	php_glob_t g;
 	size_t i;
 
 	if (!inc || !arg) return;
 	if (*error) return; /* We got already an error. Switch to the end. */
-	spprintf(&filename, 0, "%s", ini_filename);
+
+	const char *filename = ini_filename;
 
 	{
 		g.gl_offs = 0;
@@ -1398,31 +1398,26 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */
 #ifdef PHP_GLOB_NOMATCH
 			if (i == PHP_GLOB_NOMATCH) {
 				zlog(ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno);
-				efree(filename);
 				return;
 			}
 #endif /* PHP_GLOB_NOMATCH */
 			zlog(ZLOG_ERROR, "Unable to globalize '%s' (ret=%zd) from %s at line %d.", inc, i, filename, ini_lineno);
 			*error = 1;
-			efree(filename);
 			return;
 		}
 
 		for (i = 0; i < g.gl_pathc; i++) {
-			int len = strlen(g.gl_pathv[i]);
+			size_t len = strlen(g.gl_pathv[i]);
 			if (len < 1) continue;
 			if (g.gl_pathv[i][len - 1] == '/') continue; /* don't parse directories */
 			if (0 > fpm_conf_load_ini_file(g.gl_pathv[i])) {
 				zlog(ZLOG_ERROR, "Unable to include %s from %s at line %d", g.gl_pathv[i], filename, ini_lineno);
 				*error = 1;
-				efree(filename);
 				return;
 			}
 		}
 		php_globfree(&g);
 	}
-
-	efree(filename);
 }
 /* }}} */
 
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 84bd7a076acec..e797a696a4b06 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -111,7 +111,7 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
 				array_init(&params);
 
 				while (next) {
-					char *buffered = NULL;
+					zend_string *buffered = NULL;
 
 					switch (next->type) {
 						case OP_PARAM:
@@ -125,28 +125,28 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
 						break;
 
 						case METHOD_PARAM:
-							spprintf(&buffered, 0, "%s::%s", next->method.class, next->method.name);
-							add_next_index_string(&params, buffered);
+							buffered = strpprintf(0, "%s::%s", next->method.class, next->method.name);
+							add_next_index_str(&params, buffered);
 						break;
 
 						case NUMERIC_METHOD_PARAM:
-							spprintf(&buffered, 0, "%s::%s#"ZEND_LONG_FMT, next->method.class, next->method.name, next->num);
-							add_next_index_string(&params, buffered);
+							buffered = strpprintf(0, "%s::%s#"ZEND_LONG_FMT, next->method.class, next->method.name, next->num);
+							add_next_index_str(&params, buffered);
 						break;
 
 						case NUMERIC_FUNCTION_PARAM:
-							spprintf(&buffered, 0, "%s#"ZEND_LONG_FMT, next->str, next->num);
-							add_next_index_string(&params, buffered);
+							buffered = strpprintf(0, "%s#"ZEND_LONG_FMT, next->str, next->num);
+							add_next_index_str(&params, buffered);
 						break;
 
 						case FILE_PARAM:
-							spprintf(&buffered, 0, "%s:"ZEND_ULONG_FMT, next->file.name, next->file.line);
-							add_next_index_string(&params, buffered);
+							buffered = strpprintf(0, "%s:"ZEND_ULONG_FMT, next->file.name, next->file.line);
+							add_next_index_str(&params, buffered);
 						break;
 
 						case NUMERIC_FILE_PARAM:
-							spprintf(&buffered, 0, "%s:#"ZEND_ULONG_FMT, next->file.name, next->file.line);
-							add_next_index_string(&params, buffered);
+							buffered = strpprintf(0, "%s:#"ZEND_ULONG_FMT, next->file.name, next->file.line);
+							add_next_index_str(&params, buffered);
 						break;
 
 						default: {
