Strange behavior of Yii, when the code is encoded ionCube

(Stepan Selyuk) #1


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?

(Alexander Makarov) #2

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.

(Stepan Selyuk) #3

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 :)

(Nick) #4

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.


(Alexander Makarov) #5


Thanks for explaination and welcome to our forums!

(Mr Ermangulhan) #6

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

(Stepan Selyuk) #7

Just encode to ioncube framework folder too.

(Mr Ermangulhan) #8

Thanks Stepan. It works.

(Stepan Selyuk) #9

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 .

(Gloriatorios) #10

Thank you so much Stepan

(Adrian Drozdz) #11

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.