Commit 5b00437a09d for php.net
commit 5b00437a09de5bb0ae1631527d519e6ad9851a33
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Thu Jul 9 11:39:37 2026 -0700
Add regression tests for `ReflectionConstant::__toString()` with null bytes
So that when the output is fixed the change can be confirmed in tests
diff --git a/ext/reflection/tests/ReflectionConstant_null_byte_value.phpt b/ext/reflection/tests/ReflectionConstant_null_byte_value.phpt
new file mode 100644
index 00000000000..5e1b855eed0
--- /dev/null
+++ b/ext/reflection/tests/ReflectionConstant_null_byte_value.phpt
@@ -0,0 +1,14 @@
+--TEST--
+GH-22658: ReflectionConstant with a string value with a null byte
+--FILE--
+<?php
+
+define('DEMO', "f\0oo");
+$r = new ReflectionConstant('DEMO');
+echo $r;
+var_dump( $r->getValue() );
+
+?>
+--EXPECTF--
+Constant [ string DEMO ] { f }
+string(4) "f%0oo"