-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Reflection: show the type of object constants used as default properties #17781
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--TEST-- | ||
ReflectionClass object default property - used to say "callable" | ||
--INI-- | ||
opcache.enable_cli=0 | ||
--FILE-- | ||
<?php | ||
|
||
class C { | ||
public stdClass $a = FOO; | ||
} | ||
define('FOO', new stdClass); | ||
|
||
new C; | ||
|
||
$reflector = new ReflectionClass(C::class); | ||
echo $reflector; | ||
?> | ||
--EXPECTF-- | ||
Class [ <user> class C ] { | ||
@@ %sReflectionClass-callable.php %d-%d | ||
|
||
- Constants [0] { | ||
} | ||
|
||
- Static properties [0] { | ||
} | ||
|
||
- Static methods [0] { | ||
} | ||
|
||
- Properties [1] { | ||
Property [ public stdClass $a = object(stdClass) ] | ||
} | ||
|
||
- Methods [0] { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
ReflectionClass object default property - used to say "__CLASS__" | ||
--INI-- | ||
opcache.enable_cli=0 | ||
--FILE-- | ||
<?php | ||
|
||
class C { | ||
public stdClass $a = FOO; | ||
} | ||
$reflector = new ReflectionClass(C::class); | ||
|
||
define('FOO', new stdClass); | ||
new C; | ||
|
||
echo $reflector; | ||
|
||
?> | ||
--EXPECTF-- | ||
Class [ <user> class C ] { | ||
@@ %sReflectionClass-class.php %d-%d | ||
|
||
- Constants [0] { | ||
} | ||
|
||
- Static properties [0] { | ||
} | ||
|
||
- Static methods [0] { | ||
} | ||
|
||
- Properties [1] { | ||
Property [ public stdClass $a = object(stdClass) ] | ||
} | ||
|
||
- Methods [0] { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
ReflectionProperty object default - used to say "callable" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this description, why would it say callable? Maybe that's just what it printed for you due to memory corruption? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea why it would say "callable", but it does - I found that depending on when the reflection object was created it would either say See my analysis at #15902 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IS_INDIRECT most likely |
||
--INI-- | ||
opcache.enable_cli=0 | ||
--FILE-- | ||
<?php | ||
|
||
class C { | ||
public stdClass $a = FOO; | ||
} | ||
define('FOO', new stdClass); | ||
|
||
new C; | ||
|
||
$reflector = new ReflectionProperty(C::class, 'a'); | ||
echo $reflector; | ||
|
||
?> | ||
--EXPECTF-- | ||
Property [ public stdClass $a = object(stdClass) ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
ReflectionProperty object default - used to say "__CLASS__" | ||
--INI-- | ||
opcache.enable_cli=0 | ||
--FILE-- | ||
<?php | ||
|
||
class C { | ||
public stdClass $a = FOO; | ||
} | ||
$reflector = new ReflectionProperty(C::class, 'a'); | ||
|
||
define('FOO', new stdClass); | ||
new C; | ||
|
||
echo $reflector; | ||
|
||
?> | ||
--EXPECTF-- | ||
Property [ public stdClass $a = object(stdClass) ] |
Uh oh!
There was an error while loading. Please reload this page.