From 44c597697b6ae7bd8795bc3ddfdddeb74073c770 Mon Sep 17 00:00:00 2001 From: Louis-Arnaud Date: Thu, 3 Sep 2026 13:53:53 +0200 Subject: [PATCH] [Sync-En] property_exists: show visibility, dynamic properties and magic methods --- .../classobj/functions/property-exists.xml | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/reference/classobj/functions/property-exists.xml b/reference/classobj/functions/property-exists.xml index b598410ca7..cf9b3cd335 100644 --- a/reference/classobj/functions/property-exists.xml +++ b/reference/classobj/functions/property-exists.xml @@ -1,6 +1,6 @@ - + @@ -89,6 +89,69 @@ myClass::test(); + + property_exists devuelve &true; independientemente de la + visibilidad de la propiedad, detecta las propiedades dinámicas añadidas a las + instancias (cuando la clase utiliza #[AllowDynamicProperties]) + e ignora los métodos mágicos + __isset + y __get. + + + + Visibilidad, propiedades dinámicas y métodos mágicos + +instanced = 'abc'; + +var_dump(property_exists($instance, 'public')); // true (pública) +var_dump(property_exists($instance, 'private')); // true (visibilidad ignorada) +var_dump(property_exists($instance, 'protectedStatic')); // true (visibilidad ignorada) +var_dump(property_exists($instance, 'instanced')); // true (propiedad dinámica en la instancia) +var_dump(property_exists($instance, 'undefined')); // false (no declarada, __isset ignorado) + +var_dump(property_exists(MyClass::class, 'public')); // true +var_dump(property_exists(MyClass::class, 'instanced')); // false (las propiedades dinámicas no están en la clase) +var_dump(property_exists(MyClass::class, 'undefined')); // false + +?> +]]> + + &example.outputs; + + + + +