facebook / facebook/hhvm

Inconsistency with PHP regarding closures and reflection

Abierto
#3,874 1 comentario 0 reacciones 1 asignado Reclamado por @paulbiss Ver en GitHub
php5 incompatibility
Lenguaje dominante
C++
Estrellas
18.7k
Forks
3.1k
Merge medio
1 h 47 min
PR fusionados (30 d)
2

Descripción

`new ReflectionFunction($closure)` seems to work as expected. However, in one case I am doing `$reflectionFunction->getParameters()` and then doing `$reflectionParameter->getDefiningFunction()`, which returns a ReflectionMethod instance in PHP (why not ReflectionFunction? no idea) that behaves differently from the original ReflectionFunction.
- `isClosure()` returns false
- `getClosureScopeClass()` returns null
- `getDeclaringClass()` returns something like "Closure$Namespace\Class::method;0000000".

http://3v4l.org/VgIeT

Some of this behaviour seems really quirky in PHP already and I can't imagine it's a high priority fix, but I thought I'd let you know.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.