-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dumped object do not include uninitialized properties #448
Comments
Look, I'm not sure if it should work as you write. Should this dump show property class X
{
public $foo;
}
$x = new X;
unset($x->foo);
dump($x); |
@dg I don't think the property However, it should be displayed when it is physically defined in a class so that the developer knows that its value may exist in some cases. What do you think? |
I prepared example with all variants - var_dump displays typed properties every time, not-typed properties only if they were not unset() and the dynamic properties. http://sandbox.onlinephpfunctions.com/code/64b434282c03f8ce7a12987ebd6fc2e4b6a4bd83 |
@janbarasek but now you are contradictory. |
@dg Ok, back to square one. Simple code: class Entity
{
public string $uninitialized;
public $foo;
}
var_dump(new Entity); Show:
It means that the native Your I think the |
So I made a working implementation which includes class-only defined properties. Needs changes, because uninitialized / unset modifiers are rendered as values, but good enough for demonstration. Here is the commit: mabar@88f3f45 Testing code: class Test
{
public int $typed = 123;
public $untyped = 123;
public int $typedNoValue;
public $untypedNoValue;
protected $prot = 'prot';
private $priv = 'priv';
public function doUnset(): void
{
unset($this->typed);
unset($this->untyped);
unset($this->typedNoValue);
unset($this->untypedNoValue);
unset($this->prot);
unset($this->priv);
}
}
$t = new Test();
bdump($t);
$t->doUnset();
$t->dynamicallySet = 'foo';
bdump($t); |
Version: 2.7.5
Bug Description
In case of PHP 7.4 entity with required scalar properties Tracy do not show required properties without value.
For example imagine simple object
OrderInfoAddress
:In case of simple dump like:
Tracy show initialized properties with value only:
Steps To Reproduce
Use my test object.
Expected Behavior & Possible Solution
Tracy should show all properties, but instead, value shows information property is uninitialized.
This settings can be detected by
\ReflectionProperty
by simple logic:$property->isInitialized($instance)
.Current behavior is confusing. In the case of inheritance of multiple classes, it is not possible to unambiguously determine whether the property was inherited or just has no value.
Thanks!
The text was updated successfully, but these errors were encountered: