Fix format specifiers and arguments in com_dotnet (GH-15398)

This is mostly about minor glitches (signedness or length confusion),
but also fixes two occasions where `zend_string`s still have been
regarded as `char *`.

We also add a regression test case for failing property name lookup,
since that is the most relevant issue we're fixing here.
This commit is contained in:
Christoph M. Becker 2024-08-15 10:59:10 +02:00 committed by GitHub
parent 04320d2fba
commit 4b2dc58651
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 16 deletions

View file

@ -245,7 +245,7 @@ PHP_METHOD(dotnet, __construct)
if (FAILED(hr)) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] [0x%08x] %s", where, hr, err);
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] [0x%08lx] %s", where, hr, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
RETURN_THROWS();
@ -258,7 +258,7 @@ PHP_METHOD(dotnet, __construct)
if (FAILED(hr)) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] [0x%08x] %s", where, hr, err);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] [0x%08lx] %s", where, hr, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
@ -270,7 +270,7 @@ PHP_METHOD(dotnet, __construct)
if (FAILED(hr)) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] [0x%08x] %s", where, hr, err);
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] [0x%08lx] %s", where, hr, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
@ -344,7 +344,7 @@ PHP_METHOD(dotnet, __construct)
if (ret == FAILURE) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08lx] %s", where, hr, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
RETURN_THROWS();