Use block parameter rather than `$1` during `gsub!` so `ActiveSupport::SafeBuffer` values aren't mangled.

Fixes #15064
Require active_support/core_ext/string/output_safety and use html_safe rather than use non-public SafeBuffer API.
Update and add tests in array_ext_test.rb

- Fix `test_to_with_instruct` typo to `test_to_xml_with_instruct`

- Rename `test_to_xml` to `test_to_xml_with_hash_elements` to make test
name more specific.

- Add `test_to_xml_with_non_hash_elements` and
`test_to_xml_with_non_hash_different_type_elements`

  `to_xml` behaves different when containing elements are same and
  different types.

- Add `test_to_xml_with_indent_set`
Update require in `array_ext_test.rb`

Removed `FIMXE` tag to require necessary file but not the whole core_ext
Dup options hash to prevent modifications

`options[:default]` and `options[:raise]` can be mistakenly added to the `options` hash. This can be a problem if you're reusing the same object.
Do not check defined?(CGI) on every call #to_query
extract pg type map initialization process to `TypeMapInitializer`.
pg, clarify default behavior for composite types.

* by default composite types are mapped as `OID::Identity` and issue a warning
* the user is advised to register his own `OID::Type` to make use of composite types

Registering a new `OID::Type` does currently not allow to specify the type casting
behavior when writing to the database. In order for it to work we need to use the
values within `@attributes`. They are already being type casted and are ready to be
written to the DB.

See https://github.com/rails/rails/blob/57643c961feb24b662620d330e71103a830003e8/activerecord/lib/active_record/attribute_methods.rb#L460-L462
Merge pull request #15068 from josepjaume/patch-1

Dup options hash to prevent modifications
Fix assertion order and :scissors: extra spaces
Merge pull request #15091 from printercu/patch-5

Do not check defined?(CGI) on every call #to_query
[postgres] include PgArrayParser directly and only load/include ArrayParser if not found
options already have symbolized keys, so we can avoid this call
the :only_path option is applied by the time the helper is called
just merge instead of dup and merge
use fewer method calls to determine the url_for options
Remove falsy deprecation note in AS guides [ci skip]

This is no longer true as @jeremy removed the deprecation in 7a5601c.
Merge pull request #15094 from gsamokovarov/patch-1

Remove falsy deprecation note in AS guides [ci skip]
calls with :host should still use the optimized path
Merge pull request #15073 from ifyouseewendy/master

Update and add tests in array_ext_test.rb