[pecl-file_formats-yaml] fix-unicode-emit: add yaml_emit_file test

From: Date: Sun, 05 Apr 2026 14:34:11 +0000
Subject: [pecl-file_formats-yaml] fix-unicode-emit: add yaml_emit_file test
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-28475@lists.php.net to get a copy of this message
Author: Rasmus Lerdorf (rlerdorf) Date: 2026-04-05T10:33:57-04:00 Commit: https://github.com/php/pecl-file_formats-yaml/commit/917397943af160306c92596bb1daf1b1bfd4bc9c Raw diff: https://github.com/php/pecl-file_formats-yaml/commit/917397943af160306c92596bb1daf1b1bfd4bc9c.diff add yaml_emit_file test Changed paths: A tests/yaml_emit_file_unicode.phpt Diff: diff --git a/tests/yaml_emit_file_unicode.phpt b/tests/yaml_emit_file_unicode.phpt new file mode 100644 index 0000000..4a010a6 --- /dev/null +++ b/tests/yaml_emit_file_unicode.phpt @@ -0,0 +1,38 @@ +--TEST-- +yaml_emit_file - Unicode output +--SKIPIF-- +<?php if(!extension_loaded('yaml')) die('skip yaml n/a'); ?> +--FILE-- +<?php +$data = array( + "city" => "香港", + "greeting" => "Iñtërnâtiônàlizætiøn", + "emoji" => "Hello 🌍", +); + +$temp_filename = dirname(__FILE__) . '/yaml_emit_file_unicode.tmp'; +var_dump(yaml_emit_file($temp_filename, $data)); +$contents = file_get_contents($temp_filename); +echo $contents; + +// verify roundtrip +$parsed = yaml_parse($contents); +var_dump($parsed["city"] === "香港"); +var_dump($parsed["greeting"] === "Iñtërnâtiônàlizætiøn"); +var_dump($parsed["emoji"] === "Hello 🌍"); +?> +--CLEAN-- +<?php +$temp_filename = dirname(__FILE__) . '/yaml_emit_file_unicode.tmp'; +@unlink($temp_filename); +?> +--EXPECT-- +bool(true) +--- +city: 香港 +greeting: Iñtërnâtiônàlizætiøn +emoji: "Hello \U0001F30D" +... +bool(true) +bool(true) +bool(true)

« previous php.pecl.cvs (#28475) next »