Bug #72222 [Com]: ReflectionClass::export doesn't handle array constants
| From: | inefedor at gmail dot com | Date: | Mon, 16 May 2016 11:36:34 +0000 |
| Subject: | Bug #72222 [Com]: ReflectionClass::export doesn't handle array constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201123@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72222&edit=1
ID: 72222
Comment by: inefedor at gmail dot com
Reported by: inefedor at gmail dot com
Summary: ReflectionClass::export doesn't handle array
constants
Status: Open
Type: Bug
Package: Reflection related
Operating System: any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I have created two PRs targeted at master and PHP-5.6 branches with fixes
Previous Comments:
------------------------------------------------------------------------
[2016-05-16 10:51:07] inefedor at gmail dot com
Description:
------------
ReflectionClass::export doesn't handle array constants and results in a Notice error being
thrown. (because of direct call to
zval_get_string() in reflection ext) https://3v4l.org/X4EN0
Test script:
---------------
class A {
const FOO = [1];
}
ReflectionClass::export("A");
Expected result:
----------------
Class [ <user> class A ] {
@@ /in/X4EN0 3-5
- Constants [1] {
Constant [ array FOO ] { Array }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [0] {
}
}
Actual result:
--------------
Notice: Array to string conversion in /in/X4EN0 on line 6
Class [ <user> class A ] {
@@ /in/X4EN0 3-5
- Constants [1] {
Constant [ array FOO ] { Array }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [0] {
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72222&edit=1