Strange behavior of Yii, when the code is encoded ionCube

Hi!

When the project is encoded using ioncube works incorrectly binding parameters to the action ($ var1 = 22, $ var2 = null) - if you call a controller action with no parameters, then an error is "invalid request".

Encoding is carried out the project with default settings ioncube. Maybe someone knows, which is why this is happening?

I guess that has something to do with reflection + ionCube issues. I’ve personally never encoded my projects so can’t be sure.

Try using $_GET[‘param’] instead of action’s $param and remove parameter itself.

I checked, this problem occurs only if the ReflectionParameter()->isDefaultValueAvailable() is used from an external unencrypted code that is out of the framework.

I also coded framework and the problem disappeared. A change in the $_GET the whole project really do not want :)

This is related to how the PHP engine implements default parameter reflection. There’s no meta data holding details of default parameters for reflection purposes, so to obtain default parameter details, the PHP engine has to resort to what is arguably a kludge of scanning the compiled bytecode to find the necessary information from the v’machine instructions related to parameter passing. ionCube compiled bytecode is protected, so the regular PHP engine bytecode searching fails when it encounters ionCube compiled code due to it not being understood. The ionCube Loader for processing encoded files contains an execution engine designed to ensure that the reflection operations on default values are able to work on encoded files, which is why the behaviour works as expected when the calling code was encoded.

ionCube

ionCube

Thanks for explaination and welcome to our forums!

I’ve the same problem. Can you explain more about your solution?

Just encode to ioncube framework folder too.

Thanks Stepan. It works.

In Yii2 you need to copy \yii\web\Controller::bindActionParams to your encoded web controller, and for the console controller: \yii\console\Controller::getActionArgsHelp and \yii\console\Controller::bindActionParams .

Thank you so much Stepan

Hi guys, I’m just about to encode my Yii2 advanced template application but could you provide me with some guidelines or tutotial how to do it so the project work flawlessly?

Backend and frontend have different domains.

I have Encoder 9.0.

Thanks so much for help.