Skip to content

Reflection: add lazy ghost tests for GH-15902 #16490

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions ext/reflection/tests/gh15902/ReflectionClass-dots.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--TEST--
ReflectionClass object default property - used to say "..."
--FILE--
<?php

class C {
public stdClass $a = FOO;
}
$reflector = new ReflectionClass(C::class);
$c = $reflector->newLazyGhost(function () {});

define('FOO', new stdClass);

$c->a;

var_dump( (string)$reflector );

?>
--EXPECTF--
string(%d) "Class [ <user> class C ] {
@@ %sReflectionClass-dots.php %d-%d

- Constants [0] {
}

- Static properties [0] {
}

- Static methods [0] {
}

- Properties [1] {
Property [ public stdClass $a = object(stdClass) ]
}

- Methods [0] {
}
}
"
22 changes: 22 additions & 0 deletions ext/reflection/tests/gh15902/ReflectionProperty-dots.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
ReflectionProperty object default - used to say "..."
--FILE--
<?php

class C {
public stdClass $a = FOO;
}
$reflector = new ReflectionProperty(C::class, 'a');
$lazyFactory = new ReflectionClass(C::class);
$c = $lazyFactory->newLazyGhost(function () {});

define('FOO', new stdClass);

$c->a;

var_dump( (string)$reflector );

?>
--EXPECTF--
string(%d) "Property [ public stdClass $a = object(stdClass) ]
"
Loading