Nested unserialize() can expose an outer object while its __unserialize() data is still being parsed
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
The issue provides a PHP reproducer that triggers the bug in php-src's unserialize. Investigate the C parser handling nested unserialize calls and shared reference tables; no specific files are named. A fix requires a design decision on rejecting references versus preserving cyclic payloads, and validation with the reproducer.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
A nested unserialize() call from Serializable::unserialize() shares the outer reference table. An r/R record can therefore resolve to an outer object whose __unserialize() data is still being parsed. At that point __unserialize() has not been queued and cannot be called because the outer parser frame is suspended.
If inner code only stores the object, identity is preserved and it is initialized later. If it accesses the object immediately, it observes incomplete userland properties and could reach uninitialized native state for internal classes.
Unlike GH-19860, this object is not fully parsed, so finishing pending callbacks at the nested boundary cannot fix this case.
Reproducer
<?php
class Outer {
public string $value;
public function __unserialize(array $data): void {
$this->value = "ready";
}
}
class Legacy implements Serializable {
public function serialize(): string {
return "";
}
public function unserialize(string $data): void {
$object = unserialize($data);
var_dump(isset($object->value));
}
public function __serialize(): array {
return [];
}
public function __unserialize(array $data): void {}
}
$result = unserialize("O:5:\"Outer\":1:{i:0;C:6:\"Legacy\":4:{r:1;}}");
echo $result->value, "\n";
Output:
bool(false)
ready
Expected behavior
This needs a separate design decision. Rejecting these references prevents unsafe access, but breaks cyclic payloads that previously retained the object until initialization completed.
- Lenguaje dominante
- C
- Estrellas
- 41.8k
- Forks
- 8.5k
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 137
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de php/php-src
-
SNMP accepts malformed remote portsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
php/php-src#25137 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
quoted_printable_encode() produces lines longer than 76 characters for bytes 0xF5 to 0xFFPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
php/php-src#24196 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Feature Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
php/php-src#24183 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de php/php-src
Issues similares
-
Implement looks_size reporterAbiertoenhancement good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
bug multiplayer status: planned
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
ChupathingyCE/chupathingyce#851 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
HigherOrderCO/Bend#2104 ·
-
Research radar digest 2026-W46Abiertoresearch-radar
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
good first issue help wanted program
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
hffgzktbcc-blip/ounce-core#297 ·
Los mantenedores suelen responder en 1 día