[php-src] Issue #8267: MySQLi uses unsupported format specifier on Windows

From: Date: Tue, 29 Mar 2022 11:15:15 +0000
Subject: [php-src] Issue #8267: MySQLi uses unsupported format specifier on Windows
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240551@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8267
Author: cmb69

### Description

The following code:

```php
<?php
$mysqli = new mysqli($host, $user, $pass, $db);
$mysqli->query("DROP TABLE IF EXISTS foo");
var_dump($mysqli->query("CREATE TABLE foo (id BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY
(id))"));
var_dump($mysqli->query("INSERT INTO foo VALUES (9223372036854775807)"));
var_dump($mysqli->insert_id);
var_dump($mysqli->query("INSERT INTO foo VALUES (0)"));
var_dump($mysqli->insert_id);

```

Resulted in this output:
```
string(5) "%I64u"
string(5) "%I64u"
```

But I expected this output instead:
```
string(19) "9223372036854775807"
string(19) "9223372036854775808"
```

The problem is that as of PHP 8.0.0, the %I* specifiers are no longer supported by our custom
snprintf and spprintf implementations. This issue came up in https://github.com/php/doc-en/issues/1483.

---

Well, actually I expected the following:
```
int(9223372036854775807)
string(19) "9223372036854775808"
```
but that [off-by-one
error](https://github.com/php/php-src/blob/4f4e4354154778edc85ee882d81b95611b12d04d/ext/mysqli/mysqli_priv.h#L84)
is a minor issue, and fixing it would be a BC break.

### PHP Version

PHP 8.0.17-dev

### Operating System

Windows


Thread (1 message)

  • cmb69
« previous php.bugs (#240551) next »