Commit 00affe43aaf for php.net
commit 00affe43aaf0734f85b759ff0f790c316f604b88
Author: Tim Düsterhus <tim@bastelstu.be>
Date: Wed Apr 23 16:21:13 2025 +0200
fileinfo: Show libmagic version with `.` in PHPInfo output (#18399)
This makes the output in PHPInfo a little more readable.
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 1dcc3346edf..143b8ba080f 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -115,10 +115,10 @@ ZEND_GET_MODULE(fileinfo)
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(fileinfo)
{
- char magic_ver[5];
+ char magic_ver[15];
- (void)snprintf(magic_ver, 4, "%d", magic_version());
- magic_ver[4] = '\0';
+ int raw_version = magic_version();
+ (void)snprintf(magic_ver, sizeof(magic_ver), "%d.%d", raw_version / 100, raw_version % 100);
php_info_print_table_start();
php_info_print_table_row(2, "fileinfo support", "enabled");