php / php/php-src

metadata checks (charsetnr) in various mysqli tests fail

Abierto
#21,338 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Bug Extension: mysqli Status: Needs Triage
Lenguaje dominante
C
Estrellas
40.4k
Forks
8.2k
Merge medio
2 d 15 h
PR fusionados (30 d)
103

Descripción

Description

The following test:

sapi/cli/php -f run-tests.php ext/mysqli/tests/mysqli_fetch_field.phpt

Resulted in this output:

========DIFF========
--
       ["decimals"]=>
       int(0)
     }
057+ [004] Expecting charset utf8/33 got 192
     bool(false)
     mysqli_result object is already closed
     array(1) {
--
========DONE========
FAIL mysqli_fetch_field() [ext/mysqli/tests/mysqli_fetch_field.phpt] 
=====================================================================
Number of tests :     1                 1
Tests skipped   :     0 (  0.0%) --------
Tests warned    :     0 (  0.0%) (  0.0%)
Tests failed    :     1 (100.0%) (100.0%)
Tests passed    :     0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      : 0.110 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
mysqli_fetch_field() [ext/mysqli/tests/mysqli_fetch_field.phpt]
=====================================================================

mysqli_set_charset() selects a character set by name only.
However, in MySQL/MariaDB a character set can have multiple collations, and the actual collation used determines the internal character set number (charsetnr) returned in metadata.

Several tests in the ext/mysqli test suite assume that setting utf8mb3 results in charsetnr = 33 (which corresponds to utf8mb3_general_ci). This assumption is not valid when the server default collation differs.

As a result, multiple tests fail depending on server configuration.

Possible workarounds (quick fix):

  • use %d in the expect section
  • use SET NAMES utf8mb3 COLLATE 'utf8mb3_general_ci' if you want to explicitly test for this character set/collation.
PHP Version
PHP 8.3.6 (cli) (built: Jan  7 2026 08:40:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
Operating System

No response

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza por ext/mysqli/tests/mysqli_fetch_field.phpt y ejecuta el comando sapi/cli/php mostrado contra un servidor cuya intercalación predeterminada sea diferente. Busca en las pruebas relacionadas de ext/mysqli expectativas codificadas de forma fija para charsetnr 33 y, después, verifica que las pruebas afectadas pasen, aceptando el valor dependiente del servidor o seleccionando explícitamente la intercalación prevista.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
mariadb, mysql, php
Área
databases, testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.