how to fix find() query that stopped working after php-mysql upgrade

A few cakephp find() functions stopped working after a server migration from php 5.2 to 5.4 and mysql 5.1 to 5.7. I am trying to fix them but according to the cake manual I do not see anything that could be wrong.

I have tried modifying the ‘conditions’ part that seems to be what is causing the problem to no avail. the function does not return anything.

function infoServorder($ev_id){
    return $this->find('all', array(
        'link' => array(
            'Service' => array(
            'QuestionnairesService' => array('Questionnaire' =>     array('conditions' => 'QuestionnairesService.questionnaire_id  = Questionnaire.id'),
            'conditions' => 'Service.id  = QuestionnairesService.service_id'
                                            ),
            'conditions' => 'Service.id  = Evaluation.service_id'
            )
        ),
        'fields' => array('Evaluation.order_id','Service.id','Service.name'),           
        'conditions' =>  array('Evaluation.id' => $ev_id, 'Questionnaire.type_q' => 'TSP'),
        'order' => array('Questionnaire.id ASC')
));                     

}   

I try to get the ‘fields’ => array(‘Evaluation.order_id’,‘Service.id’,‘Service.name’) printed on the screen in order to move forward but the function doesn’t return anything.

I have a second function that is very similar and it returns all its fields ok.

Try to copy-paste your query to mysql console.
I think it’s related with some changes in MySQL 5.7

Is debug set to true so you can see any errors.

One more case, memory limit.

Hi Ruslan, thanks for the help. I already considered MySQL new version as a possible cause for things not to work 100%. I was able to paste the generated query directly onto the MySQL editor and got an error that pointed straight to the problem, which was STRICT_TRANS_TABLES being set to true on the SQL_Mode variable. I removed it and things started working the way they’re supposed.

Thanks for the suggestion it helped a lot!

hi jimgwhit, One of the problem s I have been facing since this migration started is that I often have no clue about the errors because the actual debug kit broke. I activated it since the beginning and all I get are a bunch of errors or warnings, generally about non-static objects being called statically. I tried to edit some of the files and most of the errors disappeared. I could not get it to work again though…

BTW, if you migrate now, better to use MySQL 8.
I had the same situation couple months ago.