1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

main.c: do not use printf variant if not needed (#20418)

This commit is contained in:
Gina Peter Banyard
2025-11-08 17:26:21 +00:00
committed by GitHub
parent bc458e5d08
commit cf96153153

View File

@@ -127,8 +127,8 @@ PHPAPI char *php_get_version(sapi_module_struct *sapi_module)
{
smart_string version_info = {0};
smart_string_append_printf(&version_info,
"PHP %s (%s) (built: %s) (%s)\n",
PHP_VERSION, sapi_module->name, php_build_date,
"PHP " PHP_VERSION " (%s) (built: %s) (%s)\n",
sapi_module->name, php_build_date,
#ifdef ZTS
"ZTS"
#else
@@ -148,8 +148,12 @@ PHPAPI char *php_get_version(sapi_module_struct *sapi_module)
#endif
);
smart_string_appends(&version_info, "Copyright (c) The PHP Group\n");
if (php_build_provider()) {
smart_string_append_printf(&version_info, "Built by %s\n", php_build_provider());
const char *build_provider = php_build_provider();
if (build_provider) {
smart_string_appends(&version_info, "Built by ");
smart_string_appends(&version_info, build_provider);
smart_string_appendc(&version_info, '\n');
}
smart_string_appends(&version_info, get_zend_version());
smart_string_0(&version_info);
@@ -160,7 +164,7 @@ PHPAPI char *php_get_version(sapi_module_struct *sapi_module)
PHPAPI void php_print_version(sapi_module_struct *sapi_module)
{
char *version_info = php_get_version(sapi_module);
php_printf("%s", version_info);
PHPWRITE(version_info, strlen(version_info));
efree(version_info);
}