Memory Overflow at Doctrine Module with related entities
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
Línea de trabajo
Empieza con la prueba funcional usando persistEntity y grabEntityFromRepository y, a continuación, inspecciona cómo gestiona el módulo Doctrine las entidades con relaciones oneToMany. Compara los casos TestGroup y TestUser con el comportamiento del controlador; el trabajo estará terminado cuando las entidades relacionadas ya no produzcan una salida recursiva ni un desbordamiento de memoria.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
If an entity is on the 1 side of a 1:n relationship (i.e. it has oneToMany), and I handle it with the Doctrine Module, the object gets infinitely large, thereby causing a PHP memory overflow.
Details
I've set up these two entities:
AppBundle\Entity\TestGroup:
type: entity
table: test_group
id:
id:
type: integer
generator:
strategy: IDENTITY
fields:
name:
type: string
length: 50
nullable: true
oneToMany:
test_user:
targetEntity: TestUser
mappedBy: test_group
AppBundle\Entity\TestUser:
type: entity
table: test_user
id:
id:
type: integer
generator:
strategy: IDENTITY
fields:
group_id:
type: integer
nullable: true
name:
type: string
length: 50
nullable: true
manyToOne:
test_group:
targetEntity:
inversedBy: test_user
joinColumn:
name: group_id
referencedColumnName: id
Now I run this functional test:
public function tryMemoryLeak (FunctionalTester $I)
{
$group = new \AppBundle\Entity\TestGroup();
var_dump($group);
$I->persistEntity($group);
die;
var_dump($group);
}
Result: The output from var_dump is normal; and the entity exists in the database. But as soon as I remove die; the bug occurs: I get endless (i.e. hundreds or thousands of lines) output in the console. The same happens if I fetch the entity from the database with $I->grabEntityFromRepository.
This explains what I initially observed: If I try to pass the object to some function, I get a memory overflow crash from PHP.
I've tried it with SQLite and PostgreSQL.
If I do the same with the TestUser entity, everything is normal. So I'm figuring it has something to do with the oneToMany setting.
And if I do it in a controller, everything is fine too - so I'm figuring there's no error in the entities.
Setup
- Codeception version: 2.3.5
- PHP Version: 7.1
- Operating System: Windows 10
- Lenguaje dominante
- PHP
- Estrellas
- 4
- Forks
- 2
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 Codeception/module-doctrine
-
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Codeception/module-doctrine#2 · 1 comentario · 1 reacción ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
Codeception/module-doctrine#6 · 1 comentario ·
Todos los issues de Codeception/module-doctrine
Issues similares
-
bug No Code Attached Yet
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
joomla/joomla-cms#48556 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 3 días
-
Перевод устарел
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
-
Form
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
symfony/symfony-docs#23159 ·
Los mantenedores suelen responder en 3 días