Skip to content

Commit 00affe4

Browse files
authored
fileinfo: Show libmagic version with . in PHPInfo output (php#18399)
This makes the output in PHPInfo a little more readable.
1 parent 7e15a07 commit 00affe4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/fileinfo/fileinfo.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ ZEND_GET_MODULE(fileinfo)
115115
/* {{{ PHP_MINFO_FUNCTION */
116116
PHP_MINFO_FUNCTION(fileinfo)
117117
{
118-
char magic_ver[5];
118+
char magic_ver[15];
119119

120-
(void)snprintf(magic_ver, 4, "%d", magic_version());
121-
magic_ver[4] = '\0';
120+
int raw_version = magic_version();
121+
(void)snprintf(magic_ver, sizeof(magic_ver), "%d.%d", raw_version / 100, raw_version % 100);
122122

123123
php_info_print_table_start();
124124
php_info_print_table_row(2, "fileinfo support", "enabled");

0 commit comments

Comments
 (0)