Skip to content

Commit ed3e06a

Browse files
phpGH-22658: avoid truncation on null bytes in ReflectionConstant::__toString()
1 parent 5b00437 commit ed3e06a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

ext/reflection/php_reflection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static void _const_string(smart_str *str, const char *name, zval *value, const c
585585
if (Z_TYPE_P(value) == IS_ARRAY) {
586586
smart_str_append(str, ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED));
587587
} else if (Z_TYPE_P(value) == IS_STRING) {
588-
smart_str_appends(str, Z_STRVAL_P(value));
588+
smart_str_append(str, Z_STR_P(value));
589589
} else {
590590
zend_string *tmp_value_str;
591591
zend_string *value_str = zval_get_tmp_string(value, &tmp_value_str);

ext/reflection/tests/ReflectionConstant_null_byte_value.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ var_dump( $r->getValue() );
1010

1111
?>
1212
--EXPECTF--
13-
Constant [ string DEMO ] { f }
13+
Constant [ string DEMO ] { f%0oo }
1414
string(4) "f%0oo"

0 commit comments

Comments
 (0)