Skip to content

MySQLi uses unsupported format specifier on Windows #8267

Closed
@cmb69

Description

@cmb69

Description

The following code:

<?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 php/doc-en#1483.


Well, actually I expected the following:

int(9223372036854775807)
string(19) "9223372036854775808"

but that off-by-one error is a minor issue, and fixing it would be a BC break.

PHP Version

PHP 8.0.17-dev

Operating System

Windows

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions