ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder

ReflectionClass parse error ioncube 9

Author Message
pirat



Joined: 13 May 2016
Posts: 2

PostPosted: Fri May 13, 2016 10:40 am    Post subject: ReflectionClass parse error ioncube 9 Reply with quote

Hello!
when using ReflectionClass to process the file are given incorrect information

test code
Code:

<?php
include_once 'p.php';
var_dump(getConstructor('Rugento\Interkassa\Model\Payment'));

function getConstructor($className)
{
    $class = new \ReflectionClass($className);
    $result = null;
    $constructor = $class->getConstructor();
    if ($constructor) {
        $result = [];
        /** @var $parameter \ReflectionParameter */
        foreach ($constructor->getParameters() as $parameter) {
            try {
                $result[] = [
                    $parameter->getName(),
                    $parameter->getClass() !== null ? '' : null,
                    !$parameter->isOptional(),
                    $parameter->isOptional()
                    ? ($parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null)
                    : null,
                ];
            } catch (\ReflectionException $e) {
                $message = $e->getMessage();
                throw new \ReflectionException($message, 0, $e);
            }
        }
    }
    return $result;
}


File p.php
Code:
<?php
namespace Rugento\Interkassa\Model;

class Payment
{
    public function __construct(array $data = []) {}
}


open result
Code:

array(1) {
  [0]=>
  array(4) {
    [0]=>
    string(4) "data"
    [1]=>
    NULL
    [2]=>
    bool(false)
    [3]=>
    array(0) {
    }
  }
}

encode result

Code:

array(1) {
  [0]=>
  array(4) {
    [0]=>
    string(4) "data"
    [1]=>
    NULL
    [2]=>
    bool(false)
    [3]=>
    NULL
  }
}

please help
Back to top
View user's profile Send private message
alastair



Joined: 23 Feb 2010
Posts: 188

PostPosted: Fri May 13, 2016 3:14 pm    Post subject: Reply with quote

This is probably due to not using the allow-reflection options on the constructor of the Rugento\Interkassa\Model\Payment class as you are calling isDefaultValueAvailable and getDefaultValue.

On the command line you could use the following:

--allow-reflection Rugento\Interkassa\Model\*

to allow reflection on all functions and methods in that namespace.

You could also use the --allow-reflection-all option.

In the GUI, the allow-reflection options can be set in the Keys tab of the Project, as shown at http://www.ioncube.com/sa/gui_docs/settings_keys.html

If you need any further information please create a support ticket at http://support.ioncube.com
_________________
Alastair

ionCube
Back to top
View user's profile Send private message
pirat



Joined: 13 May 2016
Posts: 2

PostPosted: Fri May 13, 2016 4:51 pm    Post subject: Reply with quote

unfortunately, it doesn't work and returns NULL
Back to top
View user's profile Send private message
alastair



Joined: 23 Feb 2010
Posts: 188

PostPosted: Mon May 16, 2016 2:52 pm    Post subject: Reply with quote

Hi,

Please create a ticket about this in our Support Help Desk at http://support.ioncube.com

Please include in the ticket your encoding options if using the Encoder on the command line or your ionCube project file (.iep file) if using the GUI.
_________________
Alastair

ionCube
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum