Bug #72222 [Opn->Csd]: ReflectionClass::export doesn't handle array constants

From: Date: Wed, 13 Jul 2016 19:55:52 +0000
Subject: Bug #72222 [Opn->Csd]: ReflectionClass::export doesn't handle array constants
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202290@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
 Updated by:         nikic@php.net
 Reported by:        inefedor at gmail dot com
 Summary:            ReflectionClass::export doesn't handle array
                     constants
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Reflection related
 Operating System:   any
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Fixed by https://github.com/php/php-src/commit/eb190b4e917e537380a505c4c28b9dc2c5b3c295.


Previous Comments:
------------------------------------------------------------------------
[2016-05-16 11:36:34] inefedor at gmail dot com

I have created two PRs targeted at master and PHP-5.6 branches with fixes

------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#202290) next »