[PECL-CVS] [pecl-file_formats-yaml] fix-unicode-emit: address reviews

[email protected] (Rasmus Lerdorf) Sun, 5 Apr 2026 15:19:15 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-05T11:19:01-04:00

Commit: https://github.com/php/pecl-file_formats-yaml/commit/4540d0fdcaa55b2ded505400596c179fef0a9724
Raw diff: https://github.com/php/pecl-file_formats-yaml/commit/4540d0fdcaa55b2ded505400596c179fef0a9724.diff

address reviews

Changed paths:
  M  tests/yaml_emit_file_unicode.phpt
  M  yaml.c


Diff:

diff --git a/tests/yaml_emit_file_unicode.phpt b/tests/yaml_emit_file_unicode.phpt
index 4a010a6..17f2813 100644
--- a/tests/yaml_emit_file_unicode.phpt
+++ b/tests/yaml_emit_file_unicode.phpt
@@ -26,12 +26,12 @@ var_dump($parsed["emoji"] === "Hello 🌍");
 $temp_filename = dirname(__FILE__) . '/yaml_emit_file_unicode.tmp';
 @unlink($temp_filename);
 ?>
---EXPECT--
+--EXPECTF--
 bool(true)
 ---
 city: 香港
 greeting: Iñtërnâtiônàlizætiøn
-emoji: "Hello \U0001F30D"
+emoji: %s
 ...
 bool(true)
 bool(true)
diff --git a/yaml.c b/yaml.c
index 160d784..d8e21ec 100644
--- a/yaml.c
+++ b/yaml.c
@@ -640,7 +640,7 @@ PHP_FUNCTION(yaml_emit_file)
 	yaml_emitter_set_unicode(&emitter, 1);
 
 	RETVAL_BOOL((SUCCESS == php_yaml_write_impl(
-			&emitter, data, YAML_ANY_ENCODING, callbacks)));
+			&emitter, data, (yaml_encoding_t) encoding, callbacks)));
 
 	yaml_emitter_delete(&emitter);
 	php_stream_close(stream);