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 Loader

Laravel v5.4 DI dependency injection decode error

Author Message
chihwen



Joined: 27 Jun 2018
Posts: 1

PostPosted: Wed Jun 27, 2018 3:57 am    Post subject: Laravel v5.4 DI dependency injection decode error Reply with quote

Dears:

We got a decoding error. as follows:

## Case-1:
Quote:

production.ERROR: exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Unresolvable dependency resolving [Parameter #0 [ <optional> array $attributes ]] in class App\SystemAccount' in /var/www/ws/releases/41/vendor/laravel/framework/src/Illuminate/Container/Container.php:910
Stack trace:


Code:

    /**
     * SystemAccount constructor.
     *
     * @param array $attributes
     */
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);

        app('app')->instance(self::class, $this);

        $this->lib = app(SystemAccountLibrary::class);
    }


## Case-2:
Quote:

production.ERROR: exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Unresolvable dependency resolving [Parameter #1 [ <optional> $url ]] in class DoubleService\View\Template' in /var/www/ws/releases/41/vendor/laravel/framework/src/Illuminate/Container/Container.php:910
Stack trace:


Code:

    /**
     * Template constructor.
     *
     * @param ViewFactory $view
     * @param string      $url
     */
    public function __construct(ViewFactory $view, $url = '')
    {
        $this->view = $view;

        $this->url = $url ?: env('APP_URL');
    }


## Our environment is:
1. ionCube Encoder v9.0.5
2. ionCube Loader (enabled) v10.2.2
3. PHP v5.6.36
4. Laravel 5.4.36

Judging from the error message that the common symptom is
When Laravel automatically performs DI dependency injection, the injected object's constructor __construct() parameter with a default value.

## Tested separately using the following combinations, but all got the same error:
1. Enable Dynamic keys and decoding.
2. Enable Dynamic keys and decoding and with --allow-reflection-all.
3. Disable Dynamic keys and decoding (--disable-dynamic-decoding).

Our current solution is to ignore the php programs that have these symptoms first, and don't encode them.

Thank you for your support in advance.
Back to top
View user's profile Send private message
IC2008



Joined: 01 Oct 2019
Posts: 5

PostPosted: Mon Aug 03, 2020 10:05 am    Post subject: Reply with quote

same problem (on Windows) but with more recents versions of PHP 7.4 / Laravel 7 / Ioncube encoder 10.4.1

+1
Back to top
View user's profile Send private message
alastair



Joined: 23 Feb 2010
Posts: 371

PostPosted: Mon Aug 03, 2020 3:46 pm    Post subject: Reply with quote

@IC2008

It is best to create a ticket in our Support Help Desk at https://support.ioncube.com if you are having issues.

However, what may solve the problem is to ensure that the part of Laravel *applying* the reflection API methods getDefaultValue and/or isDefaultValueAvailable is itself encoded.

The reason for that is the way that those two reflection API methods are implemented in PHP. They work by iterating through the byte code instructions to find the instructions that set the default values for a function. However, in the encoded case that instruction will not be found when called from an unencoded file as PHP does not know that the byte code instructions are protected.

However, if they are called from an encoded file then the ionCube Loader can intercept those reflection API calls and apply its own version of those methods. That will ensure that the default value is then found.

A note about the original. posting by chihwen. In the version 9 Encoder there was an option to disable dynamic decoding (not dynamic keys) which has since been removed. However, that is irrelevant since the point is that any file applying those default value reflection API methods to encoded functions must itself be encoded. That applied even before dynamic decoding was introduced.
_________________
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 Loader 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