diff --git a/NEWS b/NEWS
index 75d6d1f09f7ff..683e7d906a84b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 8.5.0beta2
 
+- Core:
+  . Fixed bug GH-18850 (Repeated inclusion of file with __halt_compiler()
+    triggers "Constant already defined" warning). (ilutov)
+  . Fixed bug GH-19476 (pipe operator fails to correctly handle returning
+    by reference). (alexandre-daubois)
+
 - ODBC:
   . Remove ODBCVER and assume ODBC 3.5. (Calvin Buckley)
 
@@ -11,6 +17,8 @@ PHP                                                                        NEWS
 
 - Standard:
   . Fixed bug GH-16649 (UAF during array_splice). (alexandre-daubois)
+  . Passing integers outside the interval [0, 255] to chr() is now deprecated.
+    (Girgias)
 
 14 Aug 2025, PHP 8.5.0beta1
 
diff --git a/UPGRADING b/UPGRADING
index e586933fd9338..16cb0c4e3ce0b 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -423,6 +423,9 @@ PHP 8.5 UPGRADE NOTES
     opened directory has been deprecated. Provide the last opened directory
     explicitly instead.
     RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_null_to_readdir_rewinddir_and_closedir
+  . Passing integers outside the interval [0, 255] to chr() is now deprecated.
+    This is because a byte can only hold a value within this interval.
+    RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_integers_outside_the_interval_0_255_to_chr
 
 - XML:
   . The xml_parser_free() function has been deprecated, as XMLParser objects
diff --git a/Zend/tests/constants/gh18850.inc b/Zend/tests/constants/gh18850.inc
new file mode 100644
index 0000000000000..08099278ea3f2
--- /dev/null
+++ b/Zend/tests/constants/gh18850.inc
@@ -0,0 +1,5 @@
+<?php
+
+var_dump(__COMPILER_HALT_OFFSET__);
+
+__halt_compiler();
diff --git a/Zend/tests/constants/gh18850.phpt b/Zend/tests/constants/gh18850.phpt
new file mode 100644
index 0000000000000..7606d50945f51
--- /dev/null
+++ b/Zend/tests/constants/gh18850.phpt
@@ -0,0 +1,12 @@
+--TEST--
+GH-18850: Repeated inclusion of file with __halt_compiler() triggers "Constant already defined" warning
+--FILE--
+<?php
+
+require __DIR__ . '/gh18850.inc';
+require __DIR__ . '/gh18850.inc';
+
+?>
+--EXPECT--
+int(62)
+int(62)
diff --git a/Zend/tests/gc/gc_046.phpt b/Zend/tests/gc/gc_046.phpt
index d5024737365b1..8d48438535217 100644
--- a/Zend/tests/gc/gc_046.phpt
+++ b/Zend/tests/gc/gc_046.phpt
@@ -20,5 +20,6 @@ $action->filter();
 $action->filter();
 ?>
 DONE
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 DONE
diff --git a/Zend/tests/pipe_operator_reference_context.phpt b/Zend/tests/pipe_operator_reference_context.phpt
new file mode 100644
index 0000000000000..7d7572e2b2e59
--- /dev/null
+++ b/Zend/tests/pipe_operator_reference_context.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Fix GH-19476: Pipe operator with function returning by reference
+--FILE--
+<?php
+
+function &get_ref($_): string {
+    static $a = "original";
+
+    $a .= " ".$_;
+
+    return $a;
+}
+
+function &test_pipe_ref(): string {
+    return "input" |> get_ref(...);
+}
+
+$ref = &test_pipe_ref();
+echo "Before: " . $ref . "\n";
+$ref = "changed";
+echo "After: " . test_pipe_ref() . "\n";
+
+?>
+--EXPECT--
+Before: original input
+After: changed input
diff --git a/Zend/tests/type_declarations/typed_properties_113.phpt b/Zend/tests/type_declarations/typed_properties_113.phpt
index cb5c0f9276453..0aecc76f758a4 100644
--- a/Zend/tests/type_declarations/typed_properties_113.phpt
+++ b/Zend/tests/type_declarations/typed_properties_113.phpt
@@ -19,7 +19,8 @@ foreach ($obj as $k => &$v) {
 
 var_dump($obj);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(A)#1 (1) {
   ["foo"]=>
   &string(2) "42"
diff --git a/Zend/tests/type_declarations/typed_properties_114.phpt b/Zend/tests/type_declarations/typed_properties_114.phpt
index e771f4c1c1f84..5f3093dd33088 100644
--- a/Zend/tests/type_declarations/typed_properties_114.phpt
+++ b/Zend/tests/type_declarations/typed_properties_114.phpt
@@ -30,8 +30,11 @@ foreach ($obj as $k => &$v) {
 
 var_dump($obj);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Cannot assign array to reference held by property A::$foo of type string
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Cannot assign array to reference held by property A::$foo of type string
 object(A)#1 (1) {
   ["foo"]=>
diff --git a/Zend/tests/type_declarations/typed_properties_115.phpt b/Zend/tests/type_declarations/typed_properties_115.phpt
index eb96b3ee88641..6347ee0c35d6c 100644
--- a/Zend/tests/type_declarations/typed_properties_115.phpt
+++ b/Zend/tests/type_declarations/typed_properties_115.phpt
@@ -22,7 +22,8 @@ try {
 
 var_dump($obj);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Cannot acquire reference to readonly property A::$foo
 object(A)#1 (1) {
   ["foo"]=>
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index d8fb26e17768d..7f4299ff9a815 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2726,7 +2726,8 @@ static inline bool zend_is_call(zend_ast *ast) /* {{{ */
 	return ast->kind == ZEND_AST_CALL
 		|| ast->kind == ZEND_AST_METHOD_CALL
 		|| ast->kind == ZEND_AST_NULLSAFE_METHOD_CALL
-		|| ast->kind == ZEND_AST_STATIC_CALL;
+		|| ast->kind == ZEND_AST_STATIC_CALL
+		|| ast->kind == ZEND_AST_PIPE;
 }
 /* }}} */
 
@@ -4146,17 +4147,19 @@ static zend_result zend_compile_func_defined(znode *result, zend_ast_list *args)
 }
 /* }}} */
 
-static zend_result zend_compile_func_chr(znode *result, zend_ast_list *args) /* {{{ */
+static zend_result zend_compile_func_chr(znode *result, const zend_ast_list *args) /* {{{ */
 {
-
-	if (args->children == 1 &&
-	    args->child[0]->kind == ZEND_AST_ZVAL &&
-	    Z_TYPE_P(zend_ast_get_zval(args->child[0])) == IS_LONG) {
-
-		zend_long c = Z_LVAL_P(zend_ast_get_zval(args->child[0])) & 0xff;
-
+	zval *zint;
+	if (
+		args->children == 1
+		&& args->child[0]->kind == ZEND_AST_ZVAL
+		&& (zint = zend_ast_get_zval(args->child[0]))
+		&& Z_TYPE_P(zint) == IS_LONG
+		&& Z_LVAL_P(zint) >= 0
+		&& Z_LVAL_P(zint) <= 255
+	) {
 		result->op_type = IS_CONST;
-		ZVAL_CHAR(&result->u.constant, c);
+		ZVAL_CHAR(&result->u.constant, Z_LVAL_P(zint));
 		return SUCCESS;
 	} else {
 		return FAILURE;
@@ -9752,7 +9755,11 @@ static void zend_compile_halt_compiler(zend_ast *ast) /* {{{ */
 	name = zend_mangle_property_name(const_name, sizeof(const_name) - 1,
 		ZSTR_VAL(filename), ZSTR_LEN(filename), 0);
 
-	zend_register_long_constant(ZSTR_VAL(name), ZSTR_LEN(name), offset, 0, 0);
+	/* Avoid repeated declaration of the __COMPILER_HALT_OFFSET__ constant in
+	 * case this file was already included. */
+	if (!zend_hash_find(EG(zend_constants), name)) {
+		zend_register_long_constant(ZSTR_VAL(name), ZSTR_LEN(name), offset, 0, 0);
+	}
 	zend_string_release_ex(name, 0);
 }
 /* }}} */
diff --git a/ext/gd/tests/gh16232.phpt b/ext/gd/tests/gh16232.phpt
index 7f839d737bb5b..469ae633c5da2 100644
--- a/ext/gd/tests/gh16232.phpt
+++ b/ext/gd/tests/gh16232.phpt
@@ -9,10 +9,10 @@ $bad_webp = __DIR__ . "/gh16232.webp";
 copy($good_webp, $bad_webp);
 var_dump(imagecreatefromwbmp($bad_webp));
 $data = file_get_contents($bad_webp);
-$data[3] = chr(-1);
+$data[3] = chr(255);
 file_put_contents($bad_webp, $data);
 var_dump(imagecreatefromwbmp($bad_webp));
-$data[3] = chr(1000);
+$data[3] = chr(232);
 file_put_contents($bad_webp, $data);
 var_dump(imagecreatefromwbmp($bad_webp));
 unlink($bad_webp);
diff --git a/ext/phar/tests/bug77432.phpt b/ext/phar/tests/bug77432.phpt
index b3b927a5439df..3e3a9988c7dca 100644
--- a/ext/phar/tests/bug77432.phpt
+++ b/ext/phar/tests/bug77432.phpt
@@ -38,8 +38,6 @@ include("phar://" . $filename);
 --- Include 1 ---
 hello world
 --- Include 2 ---
-
-Warning: Constant  already defined in %s on line %d
 hello world
 --- After unlink ---
 
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 5cb3e27bbb861..781872cda117c 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -984,6 +984,12 @@ static void spl_array_set_array(zval *object, spl_array_object *intern, zval *ar
 			}
 		}
 	} else {
+		php_error_docref(NULL, E_DEPRECATED,
+			"Using an object as a backing array for %s is deprecated, as it allows violating class constraints and invariants",
+			instanceof_function(Z_OBJCE_P(object), spl_ce_ArrayIterator) ? "ArrayIterator" : "ArrayObject");
+		if (UNEXPECTED(EG(exception))) {
+			return;
+		}
 		if (Z_OBJ_HT_P(array) == &spl_handler_ArrayObject) {
 			ZVAL_COPY_VALUE(&garbage, &intern->array);
 			if (just_array)	{
diff --git a/ext/spl/tests/ArrayObject__serialize_saves_iterator_class.phpt b/ext/spl/tests/ArrayObject/ArrayObject__serialize_saves_iterator_class.phpt
similarity index 100%
rename from ext/spl/tests/ArrayObject__serialize_saves_iterator_class.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject__serialize_saves_iterator_class.phpt
diff --git a/ext/spl/tests/ArrayObject_clone_other_std_props.phpt b/ext/spl/tests/ArrayObject/ArrayObject_clone_other_std_props.phpt
similarity index 64%
rename from ext/spl/tests/ArrayObject_clone_other_std_props.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_clone_other_std_props.phpt
index 688954c3d7b13..f527f5b664586 100644
--- a/ext/spl/tests/ArrayObject_clone_other_std_props.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_clone_other_std_props.phpt
@@ -9,7 +9,8 @@ $c = clone $b;
 var_dump($c);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(ArrayObject)#3 (1) {
   ["storage":"ArrayObject":private]=>
   array(3) {
diff --git a/ext/spl/tests/ArrayObject_dump_during_sort.phpt b/ext/spl/tests/ArrayObject/ArrayObject_dump_during_sort.phpt
similarity index 100%
rename from ext/spl/tests/ArrayObject_dump_during_sort.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_dump_during_sort.phpt
diff --git a/ext/spl/tests/ArrayObject_enum.phpt b/ext/spl/tests/ArrayObject/ArrayObject_enum.phpt
similarity index 57%
rename from ext/spl/tests/ArrayObject_enum.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_enum.phpt
index 906c89b54dff1..a88da8fc5539c 100644
--- a/ext/spl/tests/ArrayObject_enum.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_enum.phpt
@@ -11,5 +11,7 @@ new ArrayObject(Foo::Bar);
 
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Fatal error: Uncaught InvalidArgumentException: Enums are not compatible with ArrayObject in %s:%d
 %a
diff --git a/ext/spl/tests/ArrayObject_exchange_array_during_sorting.phpt b/ext/spl/tests/ArrayObject/ArrayObject_exchange_array_during_sorting.phpt
similarity index 100%
rename from ext/spl/tests/ArrayObject_exchange_array_during_sorting.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_exchange_array_during_sorting.phpt
diff --git a/ext/spl/tests/ArrayObject_get_object_vars.phpt b/ext/spl/tests/ArrayObject/ArrayObject_get_object_vars.phpt
similarity index 69%
rename from ext/spl/tests/ArrayObject_get_object_vars.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_get_object_vars.phpt
index a80add6b95ad7..2e6b3d27f1566 100644
--- a/ext/spl/tests/ArrayObject_get_object_vars.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_get_object_vars.phpt
@@ -21,7 +21,8 @@ var_dump(get_object_vars($ao));
 var_dump($ao->getObjectVars());
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 array(0) {
 }
 array(1) {
diff --git a/ext/spl/tests/ArrayObject_illegal_offset.phpt b/ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
similarity index 100%
rename from ext/spl/tests/ArrayObject_illegal_offset.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
diff --git a/ext/spl/tests/ArrayObject_modify_shared_object_properties.phpt b/ext/spl/tests/ArrayObject/ArrayObject_modify_shared_object_properties.phpt
similarity index 58%
rename from ext/spl/tests/ArrayObject_modify_shared_object_properties.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_modify_shared_object_properties.phpt
index 24c247cabd9d0..69424204456b4 100644
--- a/ext/spl/tests/ArrayObject_modify_shared_object_properties.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_modify_shared_object_properties.phpt
@@ -10,7 +10,8 @@ $ao['a'] = 42;
 var_dump($arr);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 array(2) {
   ["a"]=>
   int(1)
diff --git a/ext/spl/tests/ArrayObject_overloaded_SplFixedArray.phpt b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt
similarity index 69%
rename from ext/spl/tests/ArrayObject_overloaded_SplFixedArray.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt
index f46e4cc1c9aa4..13065b4ac38a9 100644
--- a/ext/spl/tests/ArrayObject_overloaded_SplFixedArray.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt
@@ -12,5 +12,6 @@ try {
   echo $e->getMessage(), "\n";
 }
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Overloaded object of type SplFixedArray is not compatible with ArrayObject
diff --git a/ext/spl/tests/ArrayObject_overloaded_object_incompatible.phpt b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt
similarity index 71%
rename from ext/spl/tests/ArrayObject_overloaded_object_incompatible.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt
index 67267f0ec6a12..8cc66facc0053 100644
--- a/ext/spl/tests/ArrayObject_overloaded_object_incompatible.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt
@@ -12,7 +12,8 @@ try {
 var_dump($ao);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Overloaded object of type DateInterval is not compatible with ArrayObject
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
diff --git a/ext/spl/tests/ArrayObject_proptable_canonicalization.phpt b/ext/spl/tests/ArrayObject/ArrayObject_proptable_canonicalization.phpt
similarity index 57%
rename from ext/spl/tests/ArrayObject_proptable_canonicalization.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_proptable_canonicalization.phpt
index 006a152602682..fd10797f72b06 100644
--- a/ext/spl/tests/ArrayObject_proptable_canonicalization.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_proptable_canonicalization.phpt
@@ -1,5 +1,5 @@
 --TEST--
-When ArrayObject wraps an object, we should use proptable canonicalization
+When ArrayObject wraps an object, we should use prop table canonicalization
 --FILE--
 <?php
 
@@ -15,7 +15,8 @@ unset($ao[0]);
 var_dump($o);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(stdClass)#1 (1) {
   ["0"]=>
   int(1)
diff --git a/ext/spl/tests/ArrayObject_sort_different_backing_storage.phpt b/ext/spl/tests/ArrayObject/ArrayObject_sort_different_backing_storage.phpt
similarity index 73%
rename from ext/spl/tests/ArrayObject_sort_different_backing_storage.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_sort_different_backing_storage.phpt
index 93dd6570791c7..34ecc1018c065 100644
--- a/ext/spl/tests/ArrayObject_sort_different_backing_storage.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_sort_different_backing_storage.phpt
@@ -29,6 +29,7 @@ var_dump($ao5);
 
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   object(stdClass)#1 (2) {
@@ -38,6 +39,8 @@ object(ArrayObject)#2 (1) {
     int(2)
   }
 }
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(ArrayObject)#3 (1) {
   ["storage":"ArrayObject":private]=>
   object(ArrayObject)#2 (1) {
@@ -51,6 +54,8 @@ object(ArrayObject)#3 (1) {
   }
 }
 
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Deprecated: Creation of dynamic property ArrayObject::$a is deprecated in %s on line %d
 
 Deprecated: Creation of dynamic property ArrayObject::$b is deprecated in %s on line %d
diff --git a/ext/spl/tests/ArrayObject_std_props_no_recursion.phpt b/ext/spl/tests/ArrayObject/ArrayObject_std_props_no_recursion.phpt
similarity index 65%
rename from ext/spl/tests/ArrayObject_std_props_no_recursion.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_std_props_no_recursion.phpt
index 55ec57762fa4e..56f54844580d9 100644
--- a/ext/spl/tests/ArrayObject_std_props_no_recursion.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_std_props_no_recursion.phpt
@@ -16,6 +16,8 @@ var_dump((array) $c);
 --EXPECTF--
 Deprecated: Creation of dynamic property ArrayObject::$prop is deprecated in %s on line %d
 
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Deprecated: Creation of dynamic property ArrayObject::$prop is deprecated in %s on line %d
 array(3) {
   [0]=>
@@ -26,6 +28,8 @@ array(3) {
   int(3)
 }
 
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Deprecated: Creation of dynamic property ArrayObject::$prop is deprecated in %s on line %d
 array(1) {
   ["prop"]=>
diff --git a/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt b/ext/spl/tests/ArrayObject/ArrayObject_unserialize_empty_string.phpt
similarity index 100%
rename from ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
rename to ext/spl/tests/ArrayObject/ArrayObject_unserialize_empty_string.phpt
diff --git a/ext/spl/tests/arrayIterator_ksort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayIterator_ksort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayIterator_ksort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayIterator_ksort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject___construct_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic1.phpt
similarity index 65%
rename from ext/spl/tests/arrayObject___construct_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic1.phpt
index a14166c35e306..744a936276bdc 100644
--- a/ext/spl/tests/arrayObject___construct_basic1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_basic1.phpt
@@ -16,7 +16,7 @@ var_dump(new ArrayObject(array('key1' => 'val1')));
 echo "--> Nested ArrayObject argument:\n";
 var_dump(new ArrayObject(new ArrayObject($a)));
 ?>
---EXPECT--
+--EXPECTF--
 --> No arguments:
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
@@ -24,6 +24,8 @@ object(ArrayObject)#1 (1) {
   }
 }
 --> Object argument:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   object(stdClass)#1 (1) {
@@ -40,6 +42,10 @@ object(ArrayObject)#2 (1) {
   }
 }
 --> Nested ArrayObject argument:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   object(ArrayObject)#3 (1) {
diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic2.phpt
similarity index 85%
rename from ext/spl/tests/arrayObject___construct_basic2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic2.phpt
index 0d993a14e786b..e1d9718b4e625 100644
--- a/ext/spl/tests/arrayObject___construct_basic2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_basic2.phpt
@@ -48,6 +48,8 @@ function testAccess($c, $ao) {
 ?>
 --EXPECTF--
 --> Access prop on instance of ArrayObject:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
@@ -78,6 +80,8 @@ object(C)#1 (0) {
 }
 
 --> Access prop on instance of MyArrayObject:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic3.phpt
similarity index 86%
rename from ext/spl/tests/arrayObject___construct_basic3.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic3.phpt
index 3fb4dda5a6e97..135d87e6a843c 100644
--- a/ext/spl/tests/arrayObject___construct_basic3.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_basic3.phpt
@@ -48,6 +48,8 @@ function testAccess($c, $ao) {
 ?>
 --EXPECTF--
 --> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
@@ -78,6 +80,8 @@ object(C)#1 (0) {
 }
 
 --> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic4.phpt
similarity index 86%
rename from ext/spl/tests/arrayObject___construct_basic4.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic4.phpt
index dd8e75af9318c..2aeed29178a03 100644
--- a/ext/spl/tests/arrayObject___construct_basic4.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_basic4.phpt
@@ -48,6 +48,8 @@ function testAccess($c, $ao) {
 ?>
 --EXPECTF--
 --> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
@@ -76,6 +78,8 @@ object(C)#1 (0) {
 }
 
 --> Access prop on instance of MyArrayObject with ArrayObject::ARRAY_AS_PROPS:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic5.phpt
similarity index 87%
rename from ext/spl/tests/arrayObject___construct_basic5.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic5.phpt
index e10dcd8a8d01b..125f55d06371d 100644
--- a/ext/spl/tests/arrayObject___construct_basic5.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_basic5.phpt
@@ -48,6 +48,8 @@ function testAccess($c, $ao) {
 ?>
 --EXPECTF--
 --> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
@@ -76,6 +78,8 @@ object(C)#1 (0) {
 }
 
 --> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
   - Iteration:
       prop=>C::prop.orig
   - Read:
diff --git a/ext/spl/tests/arrayObject___construct_basic6.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic6.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject___construct_basic6.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic6.phpt
diff --git a/ext/spl/tests/arrayObject___construct_basic7.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_basic7.phpt
similarity index 71%
rename from ext/spl/tests/arrayObject___construct_basic7.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_basic7.phpt
index dd10b5fb6b996..98131c8c6b4da 100644
--- a/ext/spl/tests/arrayObject___construct_basic7.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_basic7.phpt
@@ -10,7 +10,8 @@ $ao = new ArrayObject($o);
 $ao->asort();
 var_dump($a, $o, $ao);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 array(2) {
   [0]=>
   int(2)
diff --git a/ext/spl/tests/arrayObject___construct_error1.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_error1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject___construct_error1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_error1.phpt
diff --git a/ext/spl/tests/arrayObject___construct_error2.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_error2.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject___construct_error2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject___construct_error2.phpt
diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_asort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_asort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_asort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_asort_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_asort_basic2.phpt
similarity index 83%
rename from ext/spl/tests/arrayObject_asort_basic2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_asort_basic2.phpt
index 21f0dee950070..772b370ad6778 100644
--- a/ext/spl/tests/arrayObject_asort_basic2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_asort_basic2.phpt
@@ -20,8 +20,10 @@ $ao1 = new ArrayObject($c);
 var_dump($ao1->asort());
 var_dump($ao1, $c);
 ?>
---EXPECT--
+--EXPECTF--
 *** Testing ArrayObject::asort() : basic functionality ***
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 bool(true)
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
diff --git a/ext/spl/tests/arrayObject_clone_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_clone_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_clone_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_clone_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_clone_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_clone_basic2.phpt
similarity index 84%
rename from ext/spl/tests/arrayObject_clone_basic2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_clone_basic2.phpt
index b0a82ccfbc34a..9cca59b60a9be 100644
--- a/ext/spl/tests/arrayObject_clone_basic2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_clone_basic2.phpt
@@ -17,7 +17,8 @@ $ao1['new.ao1'] = 'new element added to ao1';
 $ao2['new.ao2'] = 'new element added to ao2';
 var_dump($c, $ao1, $ao2);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(C)#1 (3) {
   ["p1"]=>
   string(32) "new prop added to c before clone"
diff --git a/ext/spl/tests/arrayObject_clone_basic3.phpt b/ext/spl/tests/ArrayObject/arrayObject_clone_basic3.phpt
similarity index 86%
rename from ext/spl/tests/arrayObject_clone_basic3.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_clone_basic3.phpt
index 214a2b87b8690..26e633bdd06aa 100644
--- a/ext/spl/tests/arrayObject_clone_basic3.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_clone_basic3.phpt
@@ -23,7 +23,10 @@ $clonedOuterArrayObject['new.coAO'] = 'new element added to $clonedOuterArrayObj
 
 var_dump($wrappedObject, $innerArrayObject, $outerArrayObject, $clonedOuterArrayObject);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(C)#1 (5) {
   ["p"]=>
   string(9) "C::p.orig"
diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_count_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_count_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_count_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_exchangeArray_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt
similarity index 71%
rename from ext/spl/tests/arrayObject_exchangeArray_basic2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt
index 1f037e90735b7..4ba09cd388f28 100644
--- a/ext/spl/tests/arrayObject_exchangeArray_basic2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt
@@ -45,6 +45,8 @@ object(ArrayObject)#%d (1) {
 }
 
 --> exchangeArray(normal object):
+
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(18) "normal object prop"
 object(ArrayObject)#%d (1) {
   ["storage":"ArrayObject":private]=>
@@ -55,6 +57,8 @@ object(ArrayObject)#%d (1) {
 }
 
 --> exchangeArray(ArrayObject):
+
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(19) "ArrayObject element"
 object(ArrayObject)#%d (1) {
   ["storage":"ArrayObject":private]=>
@@ -68,6 +72,8 @@ object(ArrayObject)#%d (1) {
 }
 
 --> exchangeArray(ArrayIterator):
+
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(21) "ArrayIterator element"
 object(ArrayObject)#%d (1) {
   ["storage":"ArrayObject":private]=>
@@ -81,6 +87,10 @@ object(ArrayObject)#%d (1) {
 }
 
 --> exchangeArray(nested ArrayObject):
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(26) "nested ArrayObject element"
 object(ArrayObject)#%d (1) {
   ["storage":"ArrayObject":private]=>
@@ -94,4 +104,4 @@ object(ArrayObject)#%d (1) {
       }
     }
   }
-}
+}
\ No newline at end of file
diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt
similarity index 71%
rename from ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt
index 49b990be8bdf2..8db9b016fda86 100644
--- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt
@@ -3,7 +3,7 @@ SPL: ArrayObject::exchangeArray() basic usage with object as underlying data sto
 --FILE--
 <?php
 
-#[AllowDynamicProperties]
+#%dAllowDynamicProperties]
 class C {
     public $pub1 = 'public1';
 }
@@ -52,6 +52,14 @@ var_dump($ao, $original, $copy);
 ?>
 --EXPECTF--
 --> exchangeArray() with objects:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: Creation of dynamic property C::$addedToSwapIn is deprecated in %s on line %d
+
+Deprecated: Creation of dynamic property C::$addedToOriginal is deprecated in %s on line %d
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   object(C)#3 (2) {
@@ -82,8 +90,12 @@ array(2) {
 
 
 --> exchangeArray() with no arg:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Exception: ArrayObject::exchangeArray() expects exactly 1 argument, 0 given
 
+Deprecated: Creation of dynamic property C::$addedToOriginal is deprecated in %s on line %d
+
 Warning: Undefined variable $copy in %s on line %d
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
@@ -104,8 +116,12 @@ NULL
 
 
 --> exchangeArray() with bad arg type:
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayObject::exchangeArray(): Argument #1 ($array) must be of type array, null given
 
+Deprecated: Creation of dynamic property C::$addedToOriginal is deprecated in %s on line %d
+
 Warning: Undefined variable $copy in %s on line %d
 object(ArrayObject)#3 (1) {
   ["storage":"ArrayObject":private]=>
diff --git a/ext/spl/tests/ArrayObject/arrayObject_getFlags_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_getFlags_basic1.phpt
new file mode 100644
index 0000000000000..35ae39862111a
--- /dev/null
+++ b/ext/spl/tests/ArrayObject/arrayObject_getFlags_basic1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+SPL: ArrayObject::getFlags() basic usage
+--FILE--
+<?php
+$ao = new ArrayObject(new ArrayObject(new stdClass));
+var_dump($ao->getFlags());
+
+$ao = new ArrayObject(new ArrayObject(array(1,2,3)), ArrayObject::STD_PROP_LIST);
+var_dump($ao->getFlags());
+
+$ao = new ArrayObject(new ArrayIterator(new ArrayObject()), ArrayObject::ARRAY_AS_PROPS);
+var_dump($ao->getFlags());
+
+$ao = new ArrayObject(new ArrayObject(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
+var_dump($ao->getFlags());
+
+$cao = clone $ao;
+var_dump($cao->getFlags());
+?>
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(0)
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(1)
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(2)
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(3)
+int(3)
diff --git a/ext/spl/tests/ArrayObject/arrayObject_getFlags_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_getFlags_basic2.phpt
new file mode 100644
index 0000000000000..0d0111edd1ecb
--- /dev/null
+++ b/ext/spl/tests/ArrayObject/arrayObject_getFlags_basic2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+SPL: ArrayObject::getFlags() - ensure flags are passed on to nested array objects and iterators.
+--FILE--
+<?php
+$ao = new ArrayObject(array(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
+var_dump($ao->getFlags());
+
+$ao2 = new ArrayObject($ao);
+var_dump($ao2->getFlags());
+var_dump($ao2->getIterator()->getFlags());
+
+$ai = new ArrayIterator($ao);
+var_dump($ai->getFlags());
+
+$ao2 = new ArrayObject($ao, 0);
+var_dump($ao2->getFlags());
+
+?>
+--EXPECTF--
+int(3)
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(3)
+int(3)
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(3)
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+int(0)
diff --git a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_getIteratorClass_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_getIteratorClass_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_ksort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_ksort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_ksort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_ksort_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_ksort_basic2.phpt
similarity index 82%
rename from ext/spl/tests/arrayObject_ksort_basic2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_ksort_basic2.phpt
index 1ac3029543d8d..6e64a1c64f0d1 100644
--- a/ext/spl/tests/arrayObject_ksort_basic2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_ksort_basic2.phpt
@@ -20,8 +20,10 @@ $ao1 = new ArrayObject($c);
 var_dump($ao1->ksort());
 var_dump($ao1, $c);
 ?>
---EXPECT--
+--EXPECTF--
 *** Testing ArrayObject::ksort() : basic functionality ***
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 bool(true)
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/ArrayObject/arrayObject_magicMethods1.phpt
similarity index 95%
rename from ext/spl/tests/arrayObject_magicMethods1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_magicMethods1.phpt
index ce29beb7177fb..7acf8787d4ab2 100644
--- a/ext/spl/tests/arrayObject_magicMethods1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_magicMethods1.phpt
@@ -68,6 +68,8 @@ echo "  Wrapping ArrayObject:\n";
 var_dump($ao);
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 --> Write existent, non-existent and dynamic:
   Original wrapped object:
 object(UsesMagic)#1 (5) {
diff --git a/ext/spl/tests/arrayObject_magicMethods2.phpt b/ext/spl/tests/ArrayObject/arrayObject_magicMethods2.phpt
similarity index 95%
rename from ext/spl/tests/arrayObject_magicMethods2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_magicMethods2.phpt
index d28c234d54f94..da3cb624b9b55 100644
--- a/ext/spl/tests/arrayObject_magicMethods2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_magicMethods2.phpt
@@ -68,6 +68,8 @@ echo "  Wrapping ArrayObject:\n";
 var_dump($ao);
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 --> Write existent, non-existent and dynamic:
 
 Deprecated: Creation of dynamic property ArrayObject::$a is deprecated in %s on line %d
diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/ArrayObject/arrayObject_magicMethods3.phpt
similarity index 95%
rename from ext/spl/tests/arrayObject_magicMethods3.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_magicMethods3.phpt
index 2ff0531e01d43..04ecfde195e7e 100644
--- a/ext/spl/tests/arrayObject_magicMethods3.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_magicMethods3.phpt
@@ -68,6 +68,8 @@ echo "  Wrapping ArrayObject:\n";
 var_dump($ao);
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 --> Write existent, non-existent and dynamic:
   Original wrapped object:
 object(UsesMagic)#1 (5) {
diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/ArrayObject/arrayObject_magicMethods4.phpt
similarity index 96%
rename from ext/spl/tests/arrayObject_magicMethods4.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_magicMethods4.phpt
index e68ef1fc47777..a4dabb86ec7cb 100644
--- a/ext/spl/tests/arrayObject_magicMethods4.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_magicMethods4.phpt
@@ -71,6 +71,8 @@ echo "  Wrapping ArrayObject:\n";
 var_dump($ao);
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 --> Write existent, non-existent and dynamic:
   Original wrapped object:
 object(C)#1 (5) {
diff --git a/ext/spl/tests/arrayObject_magicMethods5.phpt b/ext/spl/tests/ArrayObject/arrayObject_magicMethods5.phpt
similarity index 95%
rename from ext/spl/tests/arrayObject_magicMethods5.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_magicMethods5.phpt
index c0393ffea48fc..569d9c0bb543f 100644
--- a/ext/spl/tests/arrayObject_magicMethods5.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_magicMethods5.phpt
@@ -70,7 +70,9 @@ var_dump($obj);
 echo "  Wrapping ArrayObject:\n";
 var_dump($ao);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 --> Write existent, non-existent and dynamic:
 In UsesMagic::__set(a,changed)
 In UsesMagic::__set(dynamic,new)
diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/ArrayObject/arrayObject_magicMethods6.phpt
similarity index 96%
rename from ext/spl/tests/arrayObject_magicMethods6.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_magicMethods6.phpt
index 75151902210fb..ae4379c090948 100644
--- a/ext/spl/tests/arrayObject_magicMethods6.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_magicMethods6.phpt
@@ -71,6 +71,8 @@ echo "  Wrapping ArrayObject:\n";
 var_dump($ao);
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 --> Write existent, non-existent and dynamic:
   Original wrapped object:
 object(C)#1 (5) {
diff --git a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_natcasesort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_natcasesort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_natcasesort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_natsort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_natsort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_natsort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_natsort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_offsetExists_nullcheck.phpt b/ext/spl/tests/ArrayObject/arrayObject_offsetExists_nullcheck.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_offsetExists_nullcheck.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_offsetExists_nullcheck.phpt
diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_setFlags_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_setFlags_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_setFlags_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_setFlags_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_setFlags_basic2.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_setFlags_basic2.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_setFlags_basic2.phpt
diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/ArrayObject/arrayObject_setIteratorClass_error1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_setIteratorClass_error1.phpt
diff --git a/ext/spl/tests/arrayObject_uasort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_uasort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_uasort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_uasort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_uasort_error1.phpt b/ext/spl/tests/ArrayObject/arrayObject_uasort_error1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_uasort_error1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_uasort_error1.phpt
diff --git a/ext/spl/tests/arrayObject_uksort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_uksort_basic1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_uksort_basic1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_uksort_basic1.phpt
diff --git a/ext/spl/tests/arrayObject_uksort_error1.phpt b/ext/spl/tests/ArrayObject/arrayObject_uksort_error1.phpt
similarity index 100%
rename from ext/spl/tests/arrayObject_uksort_error1.phpt
rename to ext/spl/tests/ArrayObject/arrayObject_uksort_error1.phpt
diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/ArrayObject/array_001.phpt
similarity index 100%
rename from ext/spl/tests/array_001.phpt
rename to ext/spl/tests/ArrayObject/array_001.phpt
diff --git a/ext/spl/tests/array_002.phpt b/ext/spl/tests/ArrayObject/array_002.phpt
similarity index 78%
rename from ext/spl/tests/array_002.phpt
rename to ext/spl/tests/ArrayObject/array_002.phpt
index 94559f5bf7558..a305770edf90c 100644
--- a/ext/spl/tests/array_002.phpt
+++ b/ext/spl/tests/ArrayObject/array_002.phpt
@@ -18,6 +18,7 @@ var_dump($arrayObject);
 
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(ArrayObject)#%d (1) {
   ["storage":"ArrayObject":private]=>
   object(ArrayObject)#1 (1) {
diff --git a/ext/spl/tests/array_003.phpt b/ext/spl/tests/ArrayObject/array_003.phpt
similarity index 84%
rename from ext/spl/tests/array_003.phpt
rename to ext/spl/tests/ArrayObject/array_003.phpt
index 3ca23f09dc7ce..38db056250497 100644
--- a/ext/spl/tests/array_003.phpt
+++ b/ext/spl/tests/ArrayObject/array_003.phpt
@@ -35,7 +35,7 @@ foreach($test as $key => $val)
 }
 
 ?>
---EXPECT--
+--EXPECTF--
 test Object
 (
     [pub] => public
@@ -44,6 +44,8 @@ test Object
     [imp] => implicit
     [dyn] => dynamic
 )
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayObject Object
 (
     [storage:ArrayObject:private] => test Object
diff --git a/ext/spl/tests/array_004.phpt b/ext/spl/tests/ArrayObject/array_004.phpt
similarity index 100%
rename from ext/spl/tests/array_004.phpt
rename to ext/spl/tests/ArrayObject/array_004.phpt
diff --git a/ext/spl/tests/array_005.phpt b/ext/spl/tests/ArrayObject/array_005.phpt
similarity index 100%
rename from ext/spl/tests/array_005.phpt
rename to ext/spl/tests/ArrayObject/array_005.phpt
diff --git a/ext/spl/tests/array_006.phpt b/ext/spl/tests/ArrayObject/array_006.phpt
similarity index 100%
rename from ext/spl/tests/array_006.phpt
rename to ext/spl/tests/ArrayObject/array_006.phpt
diff --git a/ext/spl/tests/array_007.phpt b/ext/spl/tests/ArrayObject/array_007.phpt
similarity index 78%
rename from ext/spl/tests/array_007.phpt
rename to ext/spl/tests/ArrayObject/array_007.phpt
index 3cdd40a1dbc70..de492257c65f4 100644
--- a/ext/spl/tests/array_007.phpt
+++ b/ext/spl/tests/ArrayObject/array_007.phpt
@@ -39,7 +39,7 @@ foreach($test as $key => $val)
 }
 
 ?>
---EXPECT--
+--EXPECTF--
 test Object
 (
     [pub] => public
@@ -48,6 +48,8 @@ test Object
     [imp] => implicit
     [dyn] => dynamic
 )
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIterator Object
 (
     [storage:ArrayIterator:private] => ArrayObject Object
@@ -64,6 +66,8 @@ ArrayIterator Object
         )
 
 )
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 pub => public
 imp => implicit
 dyn => dynamic
diff --git a/ext/spl/tests/array_008.phpt b/ext/spl/tests/ArrayObject/array_008.phpt
similarity index 100%
rename from ext/spl/tests/array_008.phpt
rename to ext/spl/tests/ArrayObject/array_008.phpt
diff --git a/ext/spl/tests/array_009.phpt b/ext/spl/tests/ArrayObject/array_009.phpt
similarity index 100%
rename from ext/spl/tests/array_009.phpt
rename to ext/spl/tests/ArrayObject/array_009.phpt
diff --git a/ext/spl/tests/array_009a.phpt b/ext/spl/tests/ArrayObject/array_009a.phpt
similarity index 100%
rename from ext/spl/tests/array_009a.phpt
rename to ext/spl/tests/ArrayObject/array_009a.phpt
diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/ArrayObject/array_010.phpt
similarity index 100%
rename from ext/spl/tests/array_010.phpt
rename to ext/spl/tests/ArrayObject/array_010.phpt
diff --git a/ext/spl/tests/array_011.phpt b/ext/spl/tests/ArrayObject/array_011.phpt
similarity index 100%
rename from ext/spl/tests/array_011.phpt
rename to ext/spl/tests/ArrayObject/array_011.phpt
diff --git a/ext/spl/tests/array_012.phpt b/ext/spl/tests/ArrayObject/array_012.phpt
similarity index 79%
rename from ext/spl/tests/array_012.phpt
rename to ext/spl/tests/ArrayObject/array_012.phpt
index 5d5993d936947..f3b0fa9813b0c 100644
--- a/ext/spl/tests/array_012.phpt
+++ b/ext/spl/tests/ArrayObject/array_012.phpt
@@ -39,7 +39,7 @@ foreach($it as $key => $val)
 var_dump($it->count());
 
 ?>
---EXPECT--
+--EXPECTF--
 ===Array===
 int(3)
 zero=>0
@@ -50,6 +50,8 @@ two=>2
 int(3)
 int(3)
 ===Object===
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 int(3)
 zero=>0
 int(3)
diff --git a/ext/spl/tests/array_013.phpt b/ext/spl/tests/ArrayObject/array_013.phpt
similarity index 87%
rename from ext/spl/tests/array_013.phpt
rename to ext/spl/tests/ArrayObject/array_013.phpt
index 9ad11c8f38c79..01097bac04dc1 100644
--- a/ext/spl/tests/array_013.phpt
+++ b/ext/spl/tests/ArrayObject/array_013.phpt
@@ -70,6 +70,8 @@ var_dump($o->{0}); /* doesn't wotk anyway */
 3=>three
 4=>four
 ===Object===
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 zero=>0
 one=>1
 two=>2
diff --git a/ext/spl/tests/array_014.phpt b/ext/spl/tests/ArrayObject/array_014.phpt
similarity index 100%
rename from ext/spl/tests/array_014.phpt
rename to ext/spl/tests/ArrayObject/array_014.phpt
diff --git a/ext/spl/tests/array_015.phpt b/ext/spl/tests/ArrayObject/array_015.phpt
similarity index 100%
rename from ext/spl/tests/array_015.phpt
rename to ext/spl/tests/ArrayObject/array_015.phpt
diff --git a/ext/spl/tests/array_016.phpt b/ext/spl/tests/ArrayObject/array_016.phpt
similarity index 100%
rename from ext/spl/tests/array_016.phpt
rename to ext/spl/tests/ArrayObject/array_016.phpt
diff --git a/ext/spl/tests/array_017.phpt b/ext/spl/tests/ArrayObject/array_017.phpt
similarity index 88%
rename from ext/spl/tests/array_017.phpt
rename to ext/spl/tests/ArrayObject/array_017.phpt
index ba4842dce20c9..2a80386b6f73c 100644
--- a/ext/spl/tests/array_017.phpt
+++ b/ext/spl/tests/ArrayObject/array_017.phpt
@@ -177,6 +177,8 @@ array(3) {
 ArrayObjectEx::show()
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -245,6 +247,8 @@ array(1) {
 ===FOREACH===
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -366,6 +370,8 @@ array(3) {
 ArrayObjectEx::show()
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -434,6 +440,8 @@ array(1) {
 ===FOREACH===
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -512,6 +520,8 @@ int(1)
 bool(true)
 #####EXCHANGE#####
 ArrayObjectEx::exchange()
+
+Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ===CHECK===
 ArrayObjectEx::setFlags(0)
 ArrayObjectEx::dump()
@@ -548,6 +558,8 @@ array(3) {
 ArrayObjectEx::show()
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -607,6 +619,8 @@ array(1) {
 ===FOREACH===
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -710,6 +724,8 @@ array(3) {
 ArrayObjectEx::show()
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
@@ -769,6 +785,8 @@ array(1) {
 ===FOREACH===
 ArrayObjectEx::getIterator()
 ArrayIteratorEx::__construct()
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayIteratorEx::dump()
 array(3) {
   ["Flags"]=>
diff --git a/ext/spl/tests/array_018.phpt b/ext/spl/tests/ArrayObject/array_018.phpt
similarity index 100%
rename from ext/spl/tests/array_018.phpt
rename to ext/spl/tests/ArrayObject/array_018.phpt
diff --git a/ext/spl/tests/array_019.phpt b/ext/spl/tests/ArrayObject/array_019.phpt
similarity index 100%
rename from ext/spl/tests/array_019.phpt
rename to ext/spl/tests/ArrayObject/array_019.phpt
diff --git a/ext/spl/tests/array_020.phpt b/ext/spl/tests/ArrayObject/array_020.phpt
similarity index 100%
rename from ext/spl/tests/array_020.phpt
rename to ext/spl/tests/ArrayObject/array_020.phpt
diff --git a/ext/spl/tests/array_021.phpt b/ext/spl/tests/ArrayObject/array_021.phpt
similarity index 100%
rename from ext/spl/tests/array_021.phpt
rename to ext/spl/tests/ArrayObject/array_021.phpt
diff --git a/ext/spl/tests/array_022.phpt b/ext/spl/tests/ArrayObject/array_022.phpt
similarity index 72%
rename from ext/spl/tests/array_022.phpt
rename to ext/spl/tests/ArrayObject/array_022.phpt
index f7407bf602c75..4e8c94fd11815 100644
--- a/ext/spl/tests/array_022.phpt
+++ b/ext/spl/tests/ArrayObject/array_022.phpt
@@ -45,6 +45,8 @@ var_dump($b);
 ?>
 --EXPECTF--
 ==ArrayObject===
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(MyArrayObject)#%d (1) {
   ["bar"]=>
   string(3) "baz"
@@ -56,6 +58,8 @@ object(MyArrayObject)#%d (2) {
   string(3) "Foo"
 }
 ==ArrayIterator===
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(MyArrayIterator)#%d (1) {
   ["bar"]=>
   string(3) "baz"
diff --git a/ext/spl/tests/array_023.phpt b/ext/spl/tests/ArrayObject/array_023.phpt
similarity index 100%
rename from ext/spl/tests/array_023.phpt
rename to ext/spl/tests/ArrayObject/array_023.phpt
diff --git a/ext/spl/tests/array_024.phpt b/ext/spl/tests/ArrayObject/array_024.phpt
similarity index 100%
rename from ext/spl/tests/array_024.phpt
rename to ext/spl/tests/ArrayObject/array_024.phpt
diff --git a/ext/spl/tests/array_025.phpt b/ext/spl/tests/ArrayObject/array_025.phpt
similarity index 69%
rename from ext/spl/tests/array_025.phpt
rename to ext/spl/tests/ArrayObject/array_025.phpt
index d64f8f04c1e14..4bd4c434f4804 100644
--- a/ext/spl/tests/array_025.phpt
+++ b/ext/spl/tests/ArrayObject/array_025.phpt
@@ -10,7 +10,10 @@ print_r($obj1);
 echo "$s\n";
 print_r($obj2);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayObject::__unserialize(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ArrayObject Object
 (
     [storage:ArrayObject:private] => ArrayObject Object
diff --git a/ext/spl/tests/array_026.phpt b/ext/spl/tests/ArrayObject/array_026.phpt
similarity index 100%
rename from ext/spl/tests/array_026.phpt
rename to ext/spl/tests/ArrayObject/array_026.phpt
diff --git a/ext/spl/tests/array_027.phpt b/ext/spl/tests/ArrayObject/array_027.phpt
similarity index 100%
rename from ext/spl/tests/array_027.phpt
rename to ext/spl/tests/ArrayObject/array_027.phpt
diff --git a/ext/spl/tests/array_028.phpt b/ext/spl/tests/ArrayObject/array_028.phpt
similarity index 66%
rename from ext/spl/tests/array_028.phpt
rename to ext/spl/tests/ArrayObject/array_028.phpt
index 1adcdd3f90714..1e422fe2f990b 100644
--- a/ext/spl/tests/array_028.phpt
+++ b/ext/spl/tests/ArrayObject/array_028.phpt
@@ -21,7 +21,9 @@ foreach ($obj as $v) {
     var_dump($v);
 }
 ?>
---EXPECT--
+--EXPECTF--
 string(3) "bar"
 string(3) "bar"
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(3) "bar"
diff --git a/ext/spl/tests/bug31346.phpt b/ext/spl/tests/ArrayObject/bug31346.phpt
similarity index 54%
rename from ext/spl/tests/bug31346.phpt
rename to ext/spl/tests/ArrayObject/bug31346.phpt
index b2d29905ac767..a1088dfd013e8 100644
--- a/ext/spl/tests/bug31346.phpt
+++ b/ext/spl/tests/ArrayObject/bug31346.phpt
@@ -14,5 +14,6 @@ $i->next();
 
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ===DONE===
diff --git a/ext/spl/tests/bug38618.phpt b/ext/spl/tests/ArrayObject/bug38618.phpt
similarity index 69%
rename from ext/spl/tests/bug38618.phpt
rename to ext/spl/tests/ArrayObject/bug38618.phpt
index 71a09111a4b8b..5a865f12d636e 100644
--- a/ext/spl/tests/bug38618.phpt
+++ b/ext/spl/tests/ArrayObject/bug38618.phpt
@@ -84,14 +84,22 @@ test_array($array, 'Protected Property');
 test_array($array, 'Public Property New', RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
 test_array($array, 'Protected Property New', RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
 ?>
---EXPECT--
+--EXPECTF--
 ===Default with array===
 1 => apple
 1 => grape
 ===Public Property===
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 title => apple
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 title => grape
 ===Protected Property===
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 ===Public Property New===
 1 => apple
 1 => grape
diff --git a/ext/spl/tests/bug41691.phpt b/ext/spl/tests/ArrayObject/bug41691.phpt
similarity index 70%
rename from ext/spl/tests/bug41691.phpt
rename to ext/spl/tests/ArrayObject/bug41691.phpt
index 93af430b4884a..c808d59c2022f 100644
--- a/ext/spl/tests/bug41691.phpt
+++ b/ext/spl/tests/ArrayObject/bug41691.phpt
@@ -17,7 +17,8 @@ var_dump($a->exchangeArray(array('a'=>1,'b'=>1,'c'=>1)));
 
 echo "Done\n";
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 array(3) {
   ["a"]=>
   NULL
diff --git a/ext/spl/tests/bug44615.phpt b/ext/spl/tests/ArrayObject/bug44615.phpt
similarity index 76%
rename from ext/spl/tests/bug44615.phpt
rename to ext/spl/tests/ArrayObject/bug44615.phpt
index 0b9aa82bc300b..3ac30192170c6 100644
--- a/ext/spl/tests/bug44615.phpt
+++ b/ext/spl/tests/ArrayObject/bug44615.phpt
@@ -20,7 +20,7 @@ foreach (new RecursiveIteratorIterator($rai) as $t) {
     var_dump($t);
 }
 ?>
---EXPECT--
+--EXPECTF--
 string(1) "z"
 object(stdClass)#1 (0) {
 }
@@ -28,5 +28,7 @@ string(1) "q"
 string(1) "s"
 Second:
 string(1) "z"
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(1) "q"
 string(1) "s"
diff --git a/ext/spl/tests/bug45614.phpt b/ext/spl/tests/ArrayObject/bug45614.phpt
similarity index 87%
rename from ext/spl/tests/bug45614.phpt
rename to ext/spl/tests/ArrayObject/bug45614.phpt
index 8c688555d3797..04c4638155359 100644
--- a/ext/spl/tests/bug45614.phpt
+++ b/ext/spl/tests/ArrayObject/bug45614.phpt
@@ -39,7 +39,8 @@ $ai->rewind();
 $ai->seek(0);
 showFirstTwoItems($ai);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 --> Show the first two items:
 pub1 => public1
 pub2 => public2
diff --git a/ext/spl/tests/bug54323.phpt b/ext/spl/tests/ArrayObject/bug54323.phpt
similarity index 74%
rename from ext/spl/tests/bug54323.phpt
rename to ext/spl/tests/ArrayObject/bug54323.phpt
index 7431c9c47348a..fa1e64f4947c2 100644
--- a/ext/spl/tests/bug54323.phpt
+++ b/ext/spl/tests/ArrayObject/bug54323.phpt
@@ -18,6 +18,8 @@ function testAccess($c, $ao) {
 }
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Warning: Undefined property: C::$prop in %s on line %d
 
 Warning: Undefined array key "prop" in %s on line %d
diff --git a/ext/spl/tests/bug62672.phpt b/ext/spl/tests/ArrayObject/bug62672.phpt
similarity index 71%
rename from ext/spl/tests/bug62672.phpt
rename to ext/spl/tests/ArrayObject/bug62672.phpt
index ec40ee695504b..2d70ca71a1bd4 100644
--- a/ext/spl/tests/bug62672.phpt
+++ b/ext/spl/tests/ArrayObject/bug62672.phpt
@@ -28,5 +28,6 @@ $obj = new ObjB(new ArrayObject());
 
 var_dump($obj == unserialize(serialize($obj)));
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__unserialize(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 bool(true)
diff --git a/ext/spl/tests/ArrayObject/bug69845.phpt b/ext/spl/tests/ArrayObject/bug69845.phpt
new file mode 100644
index 0000000000000..6554e290e03a5
--- /dev/null
+++ b/ext/spl/tests/ArrayObject/bug69845.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Fixed bug #69845 (ArrayObject with ARRAY_AS_PROPS broken)
+--FILE--
+<?php
+for ($i = 0; $i<2; $i++) {
+    $data = new \ArrayObject(new stdClass(), ArrayObject::ARRAY_AS_PROPS);
+    $data->itemType = 'bulletin';
+    var_dump(!is_null($data['itemType']));
+}
+?>
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+bool(true)
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+bool(true)
diff --git a/ext/spl/tests/bug70155.phpt b/ext/spl/tests/ArrayObject/bug70155.phpt
similarity index 75%
rename from ext/spl/tests/bug70155.phpt
rename to ext/spl/tests/ArrayObject/bug70155.phpt
index a609205aca279..27521015c4872 100644
--- a/ext/spl/tests/bug70155.phpt
+++ b/ext/spl/tests/ArrayObject/bug70155.phpt
@@ -9,6 +9,8 @@ $data = unserialize($exploit);
 var_dump($data);
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::unserialize(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Deprecated: Creation of dynamic property ArrayObject::$0 is deprecated in %s on line %d
 
 Fatal error: Uncaught InvalidArgumentException: Overloaded object of type DateInterval is not compatible with ArrayObject in %s
diff --git a/ext/spl/tests/bug73209.phpt b/ext/spl/tests/ArrayObject/bug73209.phpt
similarity index 74%
rename from ext/spl/tests/bug73209.phpt
rename to ext/spl/tests/ArrayObject/bug73209.phpt
index 7383940936689..7da582b13523a 100644
--- a/ext/spl/tests/bug73209.phpt
+++ b/ext/spl/tests/ArrayObject/bug73209.phpt
@@ -19,7 +19,8 @@ foreach($iterator as $k=>$v) {
 }
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Expect to see all keys in ->props here: 
 props
 hello
diff --git a/ext/spl/tests/bug74669.phpt b/ext/spl/tests/ArrayObject/bug74669.phpt
similarity index 76%
rename from ext/spl/tests/bug74669.phpt
rename to ext/spl/tests/ArrayObject/bug74669.phpt
index 597e694296d26..17f622aaaf9d0 100644
--- a/ext/spl/tests/bug74669.phpt
+++ b/ext/spl/tests/ArrayObject/bug74669.phpt
@@ -93,13 +93,20 @@ var_dump($selfArray['foo']);
 
 ?>
 --EXPECTF--
+Deprecated: ArrayIterator::__unserialize(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 0 => test1
 1 => test2
+
+Deprecated: ArrayIterator::__unserialize(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 0 => test1
 1 => test2
 
+Deprecated: ArrayObject::unserialize(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
+
 Warning: Undefined array key "foo" in %s on line %d
 NULL
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(SelfArray)#9 (1) {
   ["foo"]=>
   string(3) "bar"
diff --git a/ext/spl/tests/gh10519.phpt b/ext/spl/tests/ArrayObject/gh10519.phpt
similarity index 88%
rename from ext/spl/tests/gh10519.phpt
rename to ext/spl/tests/ArrayObject/gh10519.phpt
index 1f7572d6e8ca6..5ef7fb3144f92 100644
--- a/ext/spl/tests/gh10519.phpt
+++ b/ext/spl/tests/ArrayObject/gh10519.phpt
@@ -62,7 +62,8 @@ $example->bugySetMethod(5, 'must be here');
 var_dump(json_encode($example));
 var_dump(json_encode($b));
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 string(51) "{"test":{"a":{"2":"","3":"","4":"","5":"in here"}}}"
 string(51) "{"test":{"a":{"2":"","3":"","4":"","5":"in here"}}}"
 string(56) "{"test":{"b":{"2":"","3":"","4":"","5":"must be here"}}}"
diff --git a/ext/spl/tests/gh11178.phpt b/ext/spl/tests/ArrayObject/gh11178.phpt
similarity index 69%
rename from ext/spl/tests/gh11178.phpt
rename to ext/spl/tests/ArrayObject/gh11178.phpt
index 3732c57a59d19..91ac55d6f814a 100644
--- a/ext/spl/tests/gh11178.phpt
+++ b/ext/spl/tests/ArrayObject/gh11178.phpt
@@ -21,7 +21,8 @@ foreach ($obj as $k => &$v) {
 
 var_dump($obj);
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 object(A)#1 (1) {
   ["x"]=>
   &int(3)
diff --git a/ext/spl/tests/gh15833_1.phpt b/ext/spl/tests/ArrayObject/gh15833_1.phpt
similarity index 71%
rename from ext/spl/tests/gh15833_1.phpt
rename to ext/spl/tests/ArrayObject/gh15833_1.phpt
index d658a770e80f5..5ee4b69e32560 100644
--- a/ext/spl/tests/gh15833_1.phpt
+++ b/ext/spl/tests/ArrayObject/gh15833_1.phpt
@@ -17,6 +17,7 @@ var_dump($recursiveArrayIterator->current());
 $recursiveArrayIterator->next();
 var_dump($recursiveArrayIterator->current());
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 int(1)
 NULL
diff --git a/ext/spl/tests/gh15833_2.phpt b/ext/spl/tests/ArrayObject/gh15833_2.phpt
similarity index 81%
rename from ext/spl/tests/gh15833_2.phpt
rename to ext/spl/tests/ArrayObject/gh15833_2.phpt
index 8f30921741fe3..5d7721e25dd24 100644
--- a/ext/spl/tests/gh15833_2.phpt
+++ b/ext/spl/tests/ArrayObject/gh15833_2.phpt
@@ -34,7 +34,8 @@ try {
     echo $e->getMessage(), "\n";
 }
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 nope 0
 nope 1
 nope 2
diff --git a/ext/spl/tests/gh15918.phpt b/ext/spl/tests/ArrayObject/gh15918.phpt
similarity index 61%
rename from ext/spl/tests/gh15918.phpt
rename to ext/spl/tests/ArrayObject/gh15918.phpt
index b26ff8adfc140..5efdb887f9b56 100644
--- a/ext/spl/tests/gh15918.phpt
+++ b/ext/spl/tests/ArrayObject/gh15918.phpt
@@ -9,5 +9,6 @@ try {
     echo $e->getMessage(), "\n";
 }
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Overloaded object of type SplFixedArray is not compatible with ArrayObject
diff --git a/ext/spl/tests/gh16646.phpt b/ext/spl/tests/ArrayObject/gh16646.phpt
similarity index 71%
rename from ext/spl/tests/gh16646.phpt
rename to ext/spl/tests/ArrayObject/gh16646.phpt
index b6cb503d8ed05..f572346ea5dfa 100644
--- a/ext/spl/tests/gh16646.phpt
+++ b/ext/spl/tests/ArrayObject/gh16646.phpt
@@ -23,7 +23,8 @@ unset($arr["b"]);
 var_dump($arr);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 C::__destruct
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
diff --git a/ext/spl/tests/gh16646_2.phpt b/ext/spl/tests/ArrayObject/gh16646_2.phpt
similarity index 67%
rename from ext/spl/tests/gh16646_2.phpt
rename to ext/spl/tests/ArrayObject/gh16646_2.phpt
index d006583500811..035087fbe22bb 100644
--- a/ext/spl/tests/gh16646_2.phpt
+++ b/ext/spl/tests/ArrayObject/gh16646_2.phpt
@@ -16,7 +16,8 @@ $arr->exchangeArray([]);
 var_dump($arr);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 C::__destruct
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
diff --git a/ext/spl/tests/ArrayObject/property_hooks.phpt b/ext/spl/tests/ArrayObject/property_hooks.phpt
index c0b2a372ebe4c..dfed649e7c630 100644
--- a/ext/spl/tests/ArrayObject/property_hooks.phpt
+++ b/ext/spl/tests/ArrayObject/property_hooks.phpt
@@ -63,6 +63,7 @@ var_dump($o->username);
 
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Check object properties directly
 string(5) "FIRST"
 string(4) "last"
diff --git a/ext/spl/tests/arrayObject_getFlags_basic1.phpt b/ext/spl/tests/arrayObject_getFlags_basic1.phpt
deleted file mode 100644
index 612a753680a38..0000000000000
--- a/ext/spl/tests/arrayObject_getFlags_basic1.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-SPL: ArrayObject::getFlags() basic usage
---FILE--
-<?php
-$ao = new ArrayObject(new ArrayObject(new stdClass));
-var_dump($ao->getFlags());
-
-$ao = new ArrayObject(new ArrayObject(array(1,2,3)), ArrayObject::STD_PROP_LIST);
-var_dump($ao->getFlags());
-
-$ao = new ArrayObject(new ArrayIterator(new ArrayObject()), ArrayObject::ARRAY_AS_PROPS);
-var_dump($ao->getFlags());
-
-$ao = new ArrayObject(new ArrayObject(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
-var_dump($ao->getFlags());
-
-$cao = clone $ao;
-var_dump($cao->getFlags());
-?>
---EXPECT--
-int(0)
-int(1)
-int(2)
-int(3)
-int(3)
diff --git a/ext/spl/tests/arrayObject_getFlags_basic2.phpt b/ext/spl/tests/arrayObject_getFlags_basic2.phpt
deleted file mode 100644
index db44322d674fa..0000000000000
--- a/ext/spl/tests/arrayObject_getFlags_basic2.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-SPL: ArrayObject::getFlags() - ensure flags are passed on to nested array objects and iterators.
---FILE--
-<?php
-$ao = new ArrayObject(array(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
-var_dump($ao->getFlags());
-
-$ao2 = new ArrayObject($ao);
-var_dump($ao2->getFlags());
-var_dump($ao2->getIterator()->getFlags());
-
-$ai = new ArrayIterator($ao);
-var_dump($ai->getFlags());
-
-$ao2 = new ArrayObject($ao, 0);
-var_dump($ao2->getFlags());
-
-?>
---EXPECT--
-int(3)
-int(3)
-int(3)
-int(3)
-int(0)
diff --git a/ext/spl/tests/bug69845.phpt b/ext/spl/tests/bug69845.phpt
deleted file mode 100644
index 09c9f2356d44a..0000000000000
--- a/ext/spl/tests/bug69845.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Fixed bug #69845 (ArrayObject with ARRAY_AS_PROPS broken)
---FILE--
-<?php
-for ($i = 0; $i<2; $i++) {
-    $data = new \ArrayObject(new stdClass(), ArrayObject::ARRAY_AS_PROPS);
-    $data->itemType = 'bulletin';
-    var_dump(!is_null($data['itemType']));
-}
-?>
---EXPECT--
-bool(true)
-bool(true)
diff --git a/ext/spl/tests/iterator_016.phpt b/ext/spl/tests/iterator_016.phpt
index abc81c165ae66..33ee78064201c 100644
--- a/ext/spl/tests/iterator_016.phpt
+++ b/ext/spl/tests/iterator_016.phpt
@@ -8,7 +8,7 @@ class Menu extends ArrayObject
     function getIterator(): RecursiveArrayIterator
     {
         echo __METHOD__ . "\n";
-        return new RecursiveArrayIterator($this);
+        return new RecursiveArrayIterator($this->getArrayCopy());
     }
 }
 
@@ -42,7 +42,18 @@ class MenuOutput extends RecursiveIteratorIterator
     }
 }
 
-$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
+$arr = [
+    "a",
+    [
+        "ba",
+        ["bba", "bbb"],
+        [
+            ["bcaa"]
+        ]
+    ],
+    ["ca"],
+    "d",
+];
 $obj = new Menu($arr);
 $rit = new MenuOutput($obj);
 foreach($rit as $k=>$v)
diff --git a/ext/spl/tests/iterator_069.phpt b/ext/spl/tests/iterator_069.phpt
index b9ee3f4b820d9..e30251fa9162f 100644
--- a/ext/spl/tests/iterator_069.phpt
+++ b/ext/spl/tests/iterator_069.phpt
@@ -3,10 +3,10 @@ SPL: RecursiveIteratorIterator cannot be used with foreach by reference
 --FILE--
 <?php
 
-$arr = array(array(1,2));
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+$recArrIt = new RecursiveArrayIterator([
+    [1, 2],
+    ['a', 'b'],
+]);
 
 $recItIt = new RecursiveIteratorIterator($recArrIt);
 
diff --git a/ext/spl/tests/iterator_071.phpt b/ext/spl/tests/iterator_071.phpt
index 7f525eb2c61d6..4f9b18d0c0748 100644
--- a/ext/spl/tests/iterator_071.phpt
+++ b/ext/spl/tests/iterator_071.phpt
@@ -3,10 +3,10 @@ SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHIL
 --FILE--
 <?php
 
-$arr = array(array(1,2),2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+$recArrIt = new RecursiveArrayIterator([
+    [1, 2],
+    ['a', 'b'],
+]);
 
 class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
 
@@ -29,4 +29,8 @@ MyRecursiveIteratorIterator::nextelement
 MyRecursiveIteratorIterator::nextelement
 0
 MyRecursiveIteratorIterator::nextelement
+0
+MyRecursiveIteratorIterator::nextelement
+1
+MyRecursiveIteratorIterator::nextelement
 1
diff --git a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
index 6a7d3eb8a514c..76bacc3615f7d 100644
--- a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
@@ -3,10 +3,10 @@ SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should
 --FILE--
 <?php
 
-$arr = array(array(1,2),2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+$recArrIt = new RecursiveArrayIterator([
+    [1, 2],
+    ['a', 'b'],
+]);
 
 class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
 
diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
index 1c96ee9fcd0bf..9256e9e3b1b27 100644
--- a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
@@ -3,10 +3,10 @@ SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which shoul
 --FILE--
 <?php
 
-$arr = array(1,2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+$recArrIt = new RecursiveArrayIterator([
+    [1, 2],
+    ['a', 'b'],
+]);
 
 class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
 
diff --git a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
index 13af7ce01986d..07dee9c4acbbc 100644
--- a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
@@ -3,10 +3,10 @@ SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be
 --FILE--
 <?php
 
-$arr = array(array(1,2));
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+$recArrIt = new RecursiveArrayIterator([
+    [1, 2],
+    ['a', 'b'],
+]);
 
 class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
 
@@ -30,6 +30,8 @@ foreach ($recItIt2 as $val) echo "$val\n";
 --EXPECTF--
 1
 2
+a
+b
 ===NEXT LOOP===
 1
 2
diff --git a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
index d92d309c754ba..f89f47e849b25 100644
--- a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
@@ -3,10 +3,10 @@ SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be
 --FILE--
 <?php
 
-$arr = array(1,2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
+$recArrIt = new RecursiveArrayIterator([
+    [1, 2],
+    ['a', 'b'],
+]);
 
 class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
 
diff --git a/ext/spl/tests/recursive_tree_iterator_007.phpt b/ext/spl/tests/recursive_tree_iterator_007.phpt
index 2907f39f26575..75f1e6386c8ee 100644
--- a/ext/spl/tests/recursive_tree_iterator_007.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_007.phpt
@@ -1,15 +1,16 @@
 --TEST--
 SPL: RecursiveTreeIterator and Exception from getEntry()
---INI--
-error_reporting=E_ALL&~E_NOTICE
 --FILE--
 <?php
 
-$ary = array(new stdClass);
+$ary = [
+    ['string'],
+    [new stdClass],
+];
 
 class RecursiveArrayIteratorAggregated implements IteratorAggregate {
-    public $it;
-    function __construct($it) {
+    public RecursiveArrayIterator $it;
+    function __construct(array $it) {
         $this->it = new RecursiveArrayIterator($it);
     }
     function getIterator(): Traversable {
@@ -27,5 +28,10 @@ try {
 }
 
 ?>
---EXPECT--
+--EXPECTF--
+[0] => |-Array
+[0] => | \-string
+[1] => \-Array
+
+Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
 Object of class stdClass could not be converted to string
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 4bc56f550fe1b..a5acb28ddb3bc 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2665,6 +2665,12 @@ PHP_FUNCTION(chr)
 		Z_PARAM_LONG(c)
 	ZEND_PARSE_PARAMETERS_END();
 
+	if (UNEXPECTED(c < 0 || c > 255)) {
+		php_error_docref(NULL, E_DEPRECATED,
+			"Providing a value not in-between 0 and 255 is deprecated,"
+			" this is because a byte value must be in the [0, 255] interval."
+			" The value used will be constrained using %% 256");
+	}
 	c &= 0xff;
 	RETURN_CHAR(c);
 }
diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt
index ff0dc7711718b..2e6efc0eda5d9 100644
--- a/ext/standard/tests/array/array_filter_variation9.phpt
+++ b/ext/standard/tests/array/array_filter_variation9.phpt
@@ -8,7 +8,7 @@ Test array_filter() function : usage variations - built-in functions as 'callbac
 
 echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
 
-$input = array(0, 1, -1, 10, 100, 1000);
+$input = array(0, 1, 10, 100);
 
 // using built-in function 'is_int' as 'callback'
 var_dump( array_filter($input, 'is_int') );
@@ -34,33 +34,25 @@ echo "Done"
 ?>
 --EXPECT--
 *** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***
-array(6) {
+array(4) {
   [0]=>
   int(0)
   [1]=>
   int(1)
   [2]=>
-  int(-1)
-  [3]=>
   int(10)
-  [4]=>
+  [3]=>
   int(100)
-  [5]=>
-  int(1000)
 }
-array(6) {
+array(4) {
   [0]=>
   int(0)
   [1]=>
   int(1)
   [2]=>
-  int(-1)
-  [3]=>
   int(10)
-  [4]=>
+  [3]=>
   int(100)
-  [5]=>
-  int(1000)
 }
 array_filter(): Argument #2 ($callback) must be a valid callback or null, function "echo" not found or invalid function name
 array_filter(): Argument #2 ($callback) must be a valid callback or null, function "isset" not found or invalid function name
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_005.phpt b/ext/standard/tests/class_object/get_object_vars_variation_005.phpt
index 1ad1bb3933293..2fed6468c5304 100644
--- a/ext/standard/tests/class_object/get_object_vars_variation_005.phpt
+++ b/ext/standard/tests/class_object/get_object_vars_variation_005.phpt
@@ -25,6 +25,7 @@ var_dump(get_object_vars($obj));
 
 ?>
 --EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 array(3) {
   ["%0A%0b"]=>
   int(42)
@@ -33,6 +34,8 @@ array(3) {
   [12]=>
   int(6)
 }
+
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 array(4) {
   ["prop"]=>
   NULL
diff --git a/ext/standard/tests/directory/DirectoryClass_readonly_handle_by_pass_via_ArrayObject.phpt b/ext/standard/tests/directory/DirectoryClass_readonly_handle_by_pass_via_ArrayObject.phpt
index 91416f2c71202..5af789ff424a5 100644
--- a/ext/standard/tests/directory/DirectoryClass_readonly_handle_by_pass_via_ArrayObject.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_readonly_handle_by_pass_via_ArrayObject.phpt
@@ -28,7 +28,8 @@ try {
 }
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
 resource(3) of type (stream)
 Error: Internal directory stream has been altered
 Error: Typed property Directory::$handle must not be accessed before initialization
diff --git a/ext/standard/tests/strings/chr_out_of_range.phpt b/ext/standard/tests/strings/chr_out_of_range.phpt
new file mode 100644
index 0000000000000..8381850e80654
--- /dev/null
+++ b/ext/standard/tests/strings/chr_out_of_range.phpt
@@ -0,0 +1,15 @@
+--TEST--
+chr() with out of range values
+--FILE--
+<?php
+
+var_dump("\xFF" == chr(-1));
+var_dump("\0" == chr(256));
+
+?>
+--EXPECTF--
+Deprecated: chr(): Providing a value not in-between 0 and 255 is deprecated, this is because a byte value must be in the [0, 255] interval. The value used will be constrained using % 256 in %s on line 3
+bool(true)
+
+Deprecated: chr(): Providing a value not in-between 0 and 255 is deprecated, this is because a byte value must be in the [0, 255] interval. The value used will be constrained using % 256 in %s on line 4
+bool(true)
diff --git a/ext/standard/tests/strings/chr_variation1.phpt b/ext/standard/tests/strings/chr_variation1.phpt
index f045fdb54a005..d181e752c2aad 100644
--- a/ext/standard/tests/strings/chr_variation1.phpt
+++ b/ext/standard/tests/strings/chr_variation1.phpt
@@ -5,36 +5,17 @@ Test chr() function : usage variations - test values for $ascii argument
 
 echo "*** Testing chr() function: with unexpected inputs for 'ascii' argument ***\n";
 
-//defining a class
-class sample  {
-  public function __toString() {
-    return "sample object";
-  }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
 // array with different values for $input
-$inputs =  array (
-
-          // integer values
-/*1*/	  0,
-          1,
-          255,
-          256,
-
-          // float values
-/*5*/	  10.5,
-          -20.5,
-          1.1234e6,
-
-          // boolean values
-/*11*/	  true,
-          false,
-          TRUE,
-          FALSE,
-);
+$inputs = [
+	0,
+	1,
+	255,
+	// float values
+	10.5,
+	// bool values
+	true,
+	false,
+];
 
 // loop through with each element of the $inputs array to test chr() function
 $count = 1;
@@ -44,8 +25,6 @@ foreach($inputs as $input) {
   $count ++;
 }
 
-fclose($file_handle);  //closing the file handle
-
 ?>
 --EXPECTF--
 *** Testing chr() function: with unexpected inputs for 'ascii' argument ***
@@ -56,22 +35,10 @@ string(2) "01"
 -- Iteration 3 --
 string(2) "ff"
 -- Iteration 4 --
-string(2) "00"
--- Iteration 5 --
 
 Deprecated: Implicit conversion from float 10.5 to int loses precision in %s on line %d
 string(2) "0a"
--- Iteration 6 --
-
-Deprecated: Implicit conversion from float -20.5 to int loses precision in %s on line %d
-string(2) "ec"
--- Iteration 7 --
-string(2) "48"
--- Iteration 8 --
-string(2) "01"
--- Iteration 9 --
-string(2) "00"
--- Iteration 10 --
+-- Iteration 5 --
 string(2) "01"
--- Iteration 11 --
+-- Iteration 6 --
 string(2) "00"
diff --git a/ext/standard/tests/strings/str_replace_variation2.phpt b/ext/standard/tests/strings/str_replace_variation2.phpt
index 957c990555ea5..d8dcd58e1b604 100644
--- a/ext/standard/tests/strings/str_replace_variation2.phpt
+++ b/ext/standard/tests/strings/str_replace_variation2.phpt
@@ -12,7 +12,7 @@ precision=14
 echo "\n*** Testing str_replace() with various subjects ***";
 $subject = "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE\000
         \x000\x5ACD\0abcd \xXYZ\tabcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)";
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)";
 
 /* needles in an array to be compared in the string $string */
 $search_str = array (
@@ -48,7 +48,7 @@ $search_str = array (
   'b',
   '\t',
   "\t",
-  chr(128).chr(234).chr(65).chr(255).chr(256),
+  chr(128).chr(234).chr(65).chr(255).chr(0),
   $subject
 );
 
@@ -65,233 +65,233 @@ for( $i = 0; $i < count($search_str); $i++ ) {
 *** Testing str_replace() with various subjects ***
 --- Iteration 0 ---
 -- String after replacing the search value is => --
-string(181) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(179) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!FOUND
-        ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '2' times
 
 --- Iteration 1 ---
 -- String after replacing the search value is => --
-string(181) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(179) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!FOUND
-        ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '2' times
 
 --- Iteration 2 ---
 -- String after replacing the search value is => --
-string(186) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(184) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: FOUND
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 3 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 4 ---
 -- String after replacing the search value is => --
-string(186) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(184) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $FOUND: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 5 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 6 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 7 ---
 -- String after replacing the search value is => --
-string(193) "Hello, world,0120333.3445FOUND67          NULL TRUE FALSE%0
+string(191) "Hello, world,0120333.3445FOUND67          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 8 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 9 ---
 -- String after replacing the search value is => --
-string(197) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0FOUND \xXYZ	FOUND $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '2' times
 
 --- Iteration 10 ---
 -- String after replacing the search value is => --
-string(197) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xFOUND	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 11 ---
 -- String after replacing the search value is => --
-string(196) "Hello, world,0120333.3445-1.234567          FOUND TRUE FALSE%0
+string(194) "Hello, world,0120333.3445-1.234567          FOUND TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 12 ---
 -- String after replacing the search value is => --
-string(211) "Hello, world,FOUND12FOUND333.3445-1.234567          NULL TRUE FALSE%0
+string(213) "Hello, world,FOUND12FOUND333.3445-1.234567          NULL TRUE FALSE%0
         %0FOUNDZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '4' times
+        ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(FOUND)"
+-- search string has found '5' times
 
 --- Iteration 13 ---
 -- String after replacing the search value is => --
-string(211) "Hello, world,FOUND12FOUND333.3445-1.234567          NULL TRUE FALSE%0
+string(213) "Hello, world,FOUND12FOUND333.3445-1.234567          NULL TRUE FALSE%0
         %0FOUNDZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '4' times
+        ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(FOUND)"
+-- search string has found '5' times
 
 --- Iteration 14 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 15 ---
 -- String after replacing the search value is => --
-string(335) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0
+string(333) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0
 FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND%00ZCD%0abcdFOUND\xXYZ	abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorld
-FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '35' times
 
 --- Iteration 16 ---
 -- String after replacing the search value is => --
-string(207) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSEFOUND
+string(205) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSEFOUND
         FOUND0ZCDFOUNDabcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '3' times
 
 --- Iteration 17 ---
 -- String after replacing the search value is => --
-string(198) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(196) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         FOUNDZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 18 ---
 -- String after replacing the search value is => --
-string(198) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(196) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00FOUNDD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 19 ---
 -- String after replacing the search value is => --
-string(198) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(196) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         FOUNDZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 20 ---
 -- String after replacing the search value is => --
-string(198) "Hello, world,0120333FOUND445-1.234567          NULL TRUE FALSE%0
+string(196) "Hello, world,0120333FOUND445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 21 ---
 -- String after replacing the search value is => --
-string(207) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE%0
+string(205) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '3' times
 
 --- Iteration 22 ---
 -- String after replacing the search value is => --
-string(196) "Hello, world,0120333.3445-1.234567          NULL FOUND FALSE%0
+string(194) "Hello, world,0120333.3445-1.234567          NULL FOUND FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 23 ---
 -- String after replacing the search value is => --
-string(207) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE%0
+string(205) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '3' times
 
 --- Iteration 24 ---
 -- String after replacing the search value is => --
-string(207) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE%0
+string(205) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '3' times
 
 --- Iteration 25 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 26 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FOUND%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FOUND%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 27 ---
 -- String after replacing the search value is => --
-string(335) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0
+string(333) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0
 FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND%00ZCD%0abcdFOUND\xXYZ	abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorld
-FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '35' times
 
 --- Iteration 28 ---
 -- String after replacing the search value is => --
-string(190) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE%0
+string(188) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 29 ---
 -- String after replacing the search value is => --
-string(203) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(201) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0aFOUNDcd \xXYZ	aFOUNDcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '2' times
 
 --- Iteration 30 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 31 ---
 -- String after replacing the search value is => --
-string(199) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(197) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZFOUNDabcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '1' times
 
 --- Iteration 32 ---
 -- String after replacing the search value is => --
-string(195) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
+string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE%0
         %00ZCD%0abcd \xXYZ	abcd $$@#%^&*!~,.:;?: !!Hello, World
-        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+        ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)"
 -- search string has found '0' times
 
 --- Iteration 33 ---
diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt
index e55b2a684fb21..1136774b38acc 100644
--- a/ext/standard/tests/strings/strcasecmp.phpt
+++ b/ext/standard/tests/strings/strcasecmp.phpt
@@ -9,7 +9,7 @@ precision = 12
 echo "#### Basic and Possible operations ####";
 /* creating an array of strings to be compared */
 $arrays = array(
-           array("a", 'A', chr(128), chr(255), chr(256)),
+           array("a", 'A', chr(128), chr(255), chr(0)),
            array("acc", "Acc", 'aC', "acCc", 'acd', "?acc", 'Acc!', "$!acc", ";acc"),
            array("1", "0", 0, "-1", -1, "", TRUE, true, FALSE, "string"),
            array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5)
diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt
index 5310566d53b60..fa94a9cc3a01a 100644
--- a/ext/standard/tests/strings/strcmp.phpt
+++ b/ext/standard/tests/strings/strcmp.phpt
@@ -9,7 +9,7 @@ precision = 12
 echo "#### Basic and Possible operations ####";
 /* creating an array of strings to be compared */
 $arrays = array(
-           array("a", "A", 'a', 'A', chr(128), chr(255), chr(256)),
+           array("a", "A", 'a', 'A', chr(128), chr(255), chr(0)),
            array("acc", "Acc", 'ac', "accc", 'acd', "?acc", 'acc!', "$!acc", ";acc"),
            array("1", "0", 0, "-1", -1, "", TRUE, FALSE, "string"),
            array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5)
diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt
index b98111f15e672..b1ff4f4e74d97 100644
--- a/ext/standard/tests/strings/strlen.phpt
+++ b/ext/standard/tests/strings/strlen.phpt
@@ -24,8 +24,8 @@ $strings = array( "Hello, World",
           "\0000",					// len = 2
           "0",
           0,
-          "\t", 					// len = 1
-          '\t', 					// len = 2
+          "\t",						// len = 1
+          '\t',						// len = 2
           TRUE,
           FALSE,
           "Hello, World\0",
@@ -36,7 +36,7 @@ $strings = array( "Hello, World",
           "Hello, World\t",
           "Hello, World\\",
           "              ",
-          chr(128).chr(234).chr(65).chr(255).chr(256),
+          chr(128).chr(234).chr(65).chr(255).chr(0),
 
           "abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=|?><-;:$
                    []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\\\\
@@ -113,11 +113,11 @@ var_dump(strlen("{$str}S"));
 echo "\n--- strlen for long float values ---\n";
 /* Here two different outputs, which depends on the rounding value
    before converting to string. Here Precision = 12  */
-var_dump(strlen(10.55555555555555555555555555));   		// len = 13
-var_dump(strlen(10.55555555595555555555555555));    		// len = 12
+var_dump(strlen(10.55555555555555555555555555));			// len = 13
+var_dump(strlen(10.55555555595555555555555555));			// len = 12
 
 echo "\n--- Nested strlen() ---\n";
-var_dump(strlen(strlen("Hello"))); 				// len=1
+var_dump(strlen(strlen("Hello")));					// len=1
 
 echo "Done\n";
 ?>
diff --git a/ext/standard/tests/strings/strncasecmp_variation6.phpt b/ext/standard/tests/strings/strncasecmp_variation6.phpt
index 78a0ddd549bf2..3a7b90616a2d2 100644
--- a/ext/standard/tests/strings/strncasecmp_variation6.phpt
+++ b/ext/standard/tests/strings/strncasecmp_variation6.phpt
@@ -10,7 +10,7 @@ echo "*** Test strncasecmp() function: with binary inputs ***\n";
 echo "\n-- Checking with all 256 characters given, in binary format --\n";
 /* loop through to get all 256 character's equivalent binary value, and check working of strncasecmp() */
 $count = 1;
-for($ASCII = 0; $ASCII <= 255; $ASCII++) {
+for($ASCII = 0; $ASCII < 255; $ASCII++) {
   $str1 = decbin($ASCII);  //ASCII value in binary form
   $str2 = decbin( ord( chr($ASCII) ) );  //Getting equivalent ASCII value for the character in binary form
   echo "-- Iteration $count --\n";
@@ -21,7 +21,7 @@ for($ASCII = 0; $ASCII <= 255; $ASCII++) {
 
 echo "\n-- Checking with out of character's range, given in binary format --\n";
 $str1 = decbin(256);
-$str2 = decbin( ord( chr(256) ));
+$str2 = decbin( ord( chr(0) ));
 var_dump( strncasecmp($str1, $str2, 8) );  //comparing all the 8-bits; expected: int(1)
 
 echo "\n*** Done ***\n";
@@ -795,9 +795,6 @@ int(0)
 -- Iteration 255 --
 int(0)
 int(0)
--- Iteration 256 --
-int(0)
-int(0)
 
 -- Checking with out of character's range, given in binary format --
 int(1)
diff --git a/ext/standard/tests/strings/strpos_variation1.phpt b/ext/standard/tests/strings/strpos_variation1.phpt
index f28517316dc46..d01b9eba24d7c 100644
--- a/ext/standard/tests/strings/strpos_variation1.phpt
+++ b/ext/standard/tests/strings/strpos_variation1.phpt
@@ -9,8 +9,8 @@ echo bin2hex( chr(128) ) ." => ";
 var_dump( strpos($string, chr(128)) );
 echo bin2hex( chr(255) ) ." => ";
 var_dump( strpos($string, chr(255), 3) );
-echo bin2hex( chr(256) ) ." => ";
-var_dump( strpos($string, chr(256)) );
+echo bin2hex( chr(0) ) ." => ";
+var_dump( strpos($string, chr(0)) );
 ?>
 
 DONE
diff --git a/ext/standard/tests/strings/strstr_variation1.phpt b/ext/standard/tests/strings/strstr_variation1.phpt
index aade1fd5f85d4..30699702f8899 100644
--- a/ext/standard/tests/strings/strstr_variation1.phpt
+++ b/ext/standard/tests/strings/strstr_variation1.phpt
@@ -9,8 +9,8 @@ echo bin2hex( chr(128) ) ." => ";
 var_dump( bin2hex( strstr($string, chr(128) ) ) );
 echo bin2hex( chr(255) ) ." => ";
 var_dump( bin2hex( strstr($string, chr(255) ) ) );
-echo bin2hex( chr(256) ) ." => ";
-var_dump( bin2hex( strstr($string, chr(256) ) ) );
+echo bin2hex( chr(0) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(0) ) ) );
 ?>
 
 DONE
diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt
index d76c56d60fb21..d7ac3dcd22d62 100644
--- a/ext/standard/tests/strings/substr_count_variation_001.phpt
+++ b/ext/standard/tests/strings/substr_count_variation_001.phpt
@@ -14,10 +14,10 @@ var_dump( substr_count("abcabcabcabcabc", "abca") );
 var_dump( substr_count("abcabcabcabcabc", "abca", 2) );
 
 echo "\n-- complex strings containing other than 7-bit chars --\n";
-$str = chr(128).chr(129).chr(128).chr(256).chr(255).chr(254).chr(255);
+$str = chr(128).chr(129).chr(128).chr(0).chr(255).chr(254).chr(255);
 var_dump(substr_count($str, chr(128)));
 var_dump(substr_count($str, chr(255)));
-var_dump(substr_count($str, chr(256)));
+var_dump(substr_count($str, chr(0)));
 
 echo "\n-- heredoc string --\n";
 $string = <<<EOD
diff --git a/ext/standard/tests/strings/substr_count_variation_002.phpt b/ext/standard/tests/strings/substr_count_variation_002.phpt
index 29b8afd9f5a38..9bf41dab4c066 100644
--- a/ext/standard/tests/strings/substr_count_variation_002.phpt
+++ b/ext/standard/tests/strings/substr_count_variation_002.phpt
@@ -5,10 +5,10 @@ Test substr_count() function (variation - 2)
 
 echo "\n*** Testing possible variations ***\n";
 echo "\n-- complex strings containing other than 7-bit chars --\n";
-$str = chr(128).chr(129).chr(128).chr(256).chr(255).chr(254).chr(255);
+$str = chr(128).chr(129).chr(128).chr(0).chr(255).chr(254).chr(255);
 var_dump(substr_count($str, chr(128)));
 var_dump(substr_count($str, chr(255)));
-var_dump(substr_count($str, chr(256)));
+var_dump(substr_count($str, chr(0)));
 
 echo "\n-- heredoc string --\n";
 $string = <<<EOD
